docs: function spawn(program) {
    let options = null;
    let args = null;
    if (arguments.length > 1 && _.isArray(arguments[1])) {
      options = arguments[2];
      args = arguments[1];
    } else {
      args = [];
      options = arguments[1];
    }
    options = _.opts(options, {
      onExit: _.noop, onStdout: _.noop, onStderr: _.noop, onData: _.noop, wait: false,
      timeout: 30, throwOnTimeout: false, uid: null, gid: null, runAs: null,
      stdoutFile: null, stderrFile: null, stdoutFileMode: 'a+', stderrFileMode: 'a+', env: {}
    });
  
    const spawnOpts = {detached: true, stdio: ['ignore', 'pipe', 'pipe'], env: _.opts(options.env, process.env)};
  
    const cwd = process.cwd();
  
    /* eslint-disable no-use-before-define */
    if (runningAsRoot()) {
      const uid = options.uid || options.runAs;
      const gid = options.gid;
      if (uid) {
        spawnOpts.uid = getUid(uid);
      }
      if (gid) {
        spawnOpts.gid = getGid(gid);
      }
    }
    /* eslint-enable no-use-before-define */
  
    if (options.cwd) {
      try {
        process.chdir(options.cwd);
        spawnOpts.cwd = options.cwd;
      } catch (e) {
        // Do nothing
      }
    }
  
    let child = null;
    try {
      child = childProcess.spawn(program, args, spawnOpts);
    } finally {
      process.chdir(cwd);
    }
    const handler = new BackgroundCommandHandler(child, _.extend(options, {stdoutFile: options.stdoutFile}));
  
    if (options.wait) {
      return handler.wait({timeout: options.timeout, throwOnTimeout: options.throwOnTimeout, detach: true});
    } else {
      return handler;
    }
  }