Awaitable wrapper around child_process.spawn.
Runs a command in a separate process. The output of the command
is ignored. Throws when the exit code is not 0.
@param  {String} cmd Name of the command
@param  {Array} args Array of arguments to the command
@return {Promise} A promise that resolves with the exit code
function(cmd, args) {
      let opts = {env: process.env};
      return new Promise((resolve, reject) => {
        let exe = child_process.spawn(cmd, args, opts);
        // suppress all output unless in verbose mode
        exe.stdout.on("data", data => {
          if (this.argv.verbose) {
            console.log(data.toString());
          }
        });
        exe.stderr.on("data", data => {
          if (this.argv.verbose) {
            console.error(data.toString());
          }
        });
        exe.on("close", code => {
          if (code !== 0) {
            let message = `Error executing ${cmd.join(" ")}. Use --verbose to see what went wrong.`;
            throw new qx.tool.cli.Utils.UserError(message);
          } else {
            resolve(0);
          }
        });
        exe.on("error", reject);
      });
    }