diff --git a/source/git-promise.js b/source/git-promise.js index 94f1cd631..9f936df76 100644 --- a/source/git-promise.js +++ b/source/git-promise.js @@ -42,7 +42,8 @@ const gitExecutorProm = (args, retryCount) => { let stderr = ''; let env = JSON.parse(JSON.stringify(process.env)); env['LC_ALL'] = 'C'; - const procOpts = { cwd: args.repoPath, maxBuffer: 1024 * 1024 * 100, detached: false, env: env } + // Run git detached, so it doesn't try to request passwords from stdin + const procOpts = { cwd: args.repoPath, maxBuffer: 1024 * 1024 * 100, detached: true, env: env } const gitProcess = child_process.spawn(gitBin, args.commands, procOpts); if (args.timeout) { setTimeout(() => { @@ -59,9 +60,8 @@ const gitExecutorProm = (args, retryCount) => { } else { gitProcess.stdout.on('data', (data) => stdout += data.toString()); } - if (args.inPipe) { - gitProcess.stdin.end(args.inPipe); - } + // Always close stdin, even when there's no inPipe + gitProcess.stdin.end(args.inPipe); gitProcess.stderr.on('data', (data) => stderr += data.toString()); gitProcess.on('error', (error) => { rejectedError = error; });