exec = (cmd, args = []) =>
  new Promise((resolve, reject) => {
    const app = spawn(cmd, args);

    let stdout = "";
    if (app.stdout) {
      app.stdout.on("data", (data) => {
        stdout += data.toString();
      });
    }

    let stderr = "";
    if (app.stderr) {
      app.stderr.on("data", (data) => {
        stderr += data.toString();
      });
    }

    app.on("close", (code) => {
      if (code !== 0 && !stdout.includes("nothing to commit")) {
        return reject(new Error(`Exit code: ${code}\n${stdout}`));
      }
      return resolve(stdout);
    });

    app.on("error", () => reject(new Error(`Exit code: ${code}\n${stderr}`)));
  })
Execute shell command
@param {String} cmd - root command
@param {String[]} args - args to be passed along with

@returns {Promise<void>}