export async function execAsync()

in gitlab/src/utils.ts [93:120]


export async function execAsync(
  executable: string,
  args: string[],
  ignoreReturnCode: boolean
): Promise<CommandOutput> {
  const command = `${executable} ${args.join(' ')}`
  return new Promise((resolve, reject) => {
    exec(command, (error, stdout, stderr) => {
      if (error) {
        console.error(`Failed to run command: ${command}: ${error.message}`)
        if (ignoreReturnCode) {
          resolve({
            returnCode: error.code || -1,
            stdout: stdout,
            stderr: stderr
          })
        }
        reject(new Error(stderr))
      } else {
        resolve({
          returnCode: 0,
          stdout: stdout,
          stderr: stderr
        })
      }
    })
  })
}