Skip to content

Commit 027eaa1

Browse files
committed
git api: resolve promise in lineHandler
The api promise will now only be resolved by the end of stdout processing for git command output handling. The promise was being resolved early before the output handlers had run. Signed-off-by: Chris. Webster <chris@webstech.net>
1 parent c7071c1 commit 027eaa1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/git.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ export function git(args: string[], options?: IGitOptions | undefined):
107107
}':\nstderr: ${result.stderr
108108
}\nstdout: ${result.stdout}\n`);
109109
}
110-
resolve(!options || options.trimTrailingNewline === false ?
111-
result.stdout : trimTrailingNewline(result.stdout));
110+
if (!options?.lineHandler) { // let callback resolve the promise
111+
resolve(!options || options.trimTrailingNewline === false ?
112+
result.stdout : trimTrailingNewline(result.stdout));
113+
}
112114
}).catch((reason) => {
113115
reject(reason);
114116
});

0 commit comments

Comments
 (0)