docs: function reply(req, res, timeout) {
    var _timer;
  
    if(timeout) {
      //console.dir(timeout);
      //console.error(Date.now());
      _timer = setTimeout(this.onTimeout, timeout);
      this._busy = true;
    }
  
    function onClose(code, signal) {
      //console.dir('close called: ' + signal);
      //console.dir(code);
      //console.dir(signal);
      this.ps.removeAllListeners();
      clearTimeout(_timer);
      this.ps = null;
      this._busy = false;
      this._written = false;
      var msg, err = new StoreError(
        null, 'script execution process exited with code: %s', code || 0);
      if(signal === 'SIGQUIT') {
        msg = 'error running script (call to %s): '
        msg += '@user_script: script killed by user with SCRIPT KILL';
        err = new StoreError(null, msg, this._script || 'user_script');
      }
      res.send(err);
    }
  
    function onMessage(msg) {
      var cmd, args;
  
      //console.dir(msg);
  
      // getting the current script name
      if(msg.event === 'eval') {
        this._script = msg.data;
        return;
  
      // calling out to execute a command
      }else if(msg.event === 'call') {
        req.cmd = msg.cmd;
        req.args = msg.args;
  
        //console.dir('got call event');
  
        var exec = this._commands[req.cmd];
        if(exec && exec.definition && exec.definition.write) {
          this._written = true;
          //console.dir('marking command as writing data...');
        }
  
        function onCommand(err, reply) {
          // restore req and res
          req.cmd = cmd;
          req.args = args;
          req.script = false;
          delete res.cb;
  
          var data = err ? err.message : reply;
          if(reply instanceof Buffer) reply = reply.toString();
          this.ps.send(
            {event: msg.event, err: (err instanceof Error), data: data});
        }
  
        req.script = true;
  
        res.cb = onCommand.bind(this);
        this.emit('command', req, res);
        //this.ps.once('message', onMessage.bind(this));
        return;
      }
  
      // ps may be null if script was killed
      if(this.ps) {
        this.ps.removeAllListeners();
      }
  
      clearTimeout(_timer);
  
      // sending data back to the client
      this._busy = false;
      this._written = false;
      var data = msg.data;
      if(msg.err) return res.send(new Error(data));
      if(msg.str) data = new String(data);
      return res.send(null, data);
    }
  
    this.ps.on('message', onMessage.bind(this));
    this.ps.once('close', onClose.bind(this));
  }