lib/plugins/aws/invokeLocal/index.js/AwsInvokeLocal/invokeLocalRuby
class AwsInvokeLocal:  invokeLocalRuby(runtime, handlerPath, handlerName, event, context) {
    const input = JSON.stringify({
      event: event || {},
      context,
    });

    return new BbPromise((resolve, reject) => {
      const ruby = spawn(
        runtime,
        [path.join(__dirname, 'invoke.rb'), handlerPath, handlerName],
        { env: process.env },
        { shell: true }
      );
      ruby.stdout.on('data', buf => this.serverless.cli.consoleLog(buf.toString()));
      ruby.stderr.on('data', buf => this.serverless.cli.consoleLog(buf.toString()));
      ruby.on('close', () => resolve());
      let isRejected = false;
      ruby.on('error', error => {
        isRejected = true;
        reject(error);
      });

      process.nextTick(() => {
        if (isRejected) return; // Runtime not available
        ruby.stdin.write(input);
        ruby.stdin.end();
      });
    });
  }