Skip to content

Commit

Permalink
Fix hanging terminal editor during conflict resolution (#501)
Browse files Browse the repository at this point in the history
Fixes #499
  • Loading branch information
kapral18 authored May 7, 2024
1 parent 077cf1c commit 31bbca7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ async function cherrypickAndHandleConflicts({
*/

if (options.editor) {
await spawnPromise(options.editor, [repoPath], options.cwd);
await spawnPromise(options.editor, [repoPath], options.cwd, true);
}

// list files with conflict markers + unstaged files and require user to resolve them
Expand Down
6 changes: 4 additions & 2 deletions src/lib/child-process-promisified.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export async function spawnPromise(
cmd: string,
cmdArgs: ReadonlyArray<string>,
cwd: string,
isInteractive = false,
): Promise<SpawnPromiseResponse> {
const spawnSpan = startSpawnSpan(cmd, cmdArgs);
const fullCmd = getFullCmd(cmd, cmdArgs);
Expand All @@ -47,15 +48,16 @@ export async function spawnPromise(

// ensure that git commands return english error messages
env: { ...process.env, LANG: 'en_US' },
...(isInteractive ? { stdio: 'inherit' } : undefined),
});
let stderr = '';
let stdout = '';

subprocess.stdout.on('data', (data: string) => {
subprocess.stdout?.on('data', (data: string) => {
stdout += data;
});

subprocess.stderr.on('data', (data: string) => {
subprocess.stderr?.on('data', (data: string) => {
stderr += data;
});

Expand Down

0 comments on commit 31bbca7

Please sign in to comment.