code: function start(cmd, { silent = false, env = null } = {}) {
      const parts = cmd.split(' ');
      const command = parts[0][0] === '.' ? path.resolve(parts[0]) : parts[0];
      const handle = {
          process: child_process_1.spawn(command, parts.slice(1), {
              stdio: silent ? 'pipe' : 'inherit',
              env: env || process.env,
              cwd: process.cwd()
          }),
          promise: Promise.resolve()
      };
      handle.promise = new Promise(function (resolve, reject) {
          let resolved = false;
          handle.process.once('error', error => {
              resolved = true;
              reject(error);
          });
          handle.process.once('exit', (code, signal) => {
              if (resolved)
                  return;
              if (code === 0) {
                  resolve();
              }
              else {
                  signal = signal ? `${signal}:` : '';
                  reject(new Error(`Child exited with ${signal}${code}`));
              }
          });
      });
      return Promise.resolve(handle);
  }
docs: See: https://github.com/zamnuts/nodejs-fork-example