Skip to content

Commit

Permalink
fix: trim output lines before splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed Dec 9, 2024
1 parent f77ca5f commit 9f99c1c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Git.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,14 +452,14 @@ class Git {
const process = child_process.spawn(this.command, commandArgs, execOptions);

if (execOptions.passthrough) {
process.stdout.on('data', data => data.toString().split(/\n/).forEach(line => logger.info(line.trimEnd())));
process.stderr.on('data', data => data.toString().split(/\n/).forEach(line => logger.error(line.trimEnd())));
process.stdout.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => logger.info(line.trimEnd())));
process.stderr.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => logger.error(line.trimEnd())));
} else {
if (execOptions.onStdout) {
process.stdout.on('data', data => data.toString().split(/\n/).forEach(line => execOptions.onStdout(line.trimEnd())));
process.stdout.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => execOptions.onStdout(line.trimEnd())));
}
if (execOptions.onStderr) {
process.stderr.on('data', data => data.toString().split(/\n/).forEach(line => execOptions.onStderr(line.trimEnd())));
process.stderr.on('data', data => data.toString().trimEnd().split(/\n/).forEach(line => execOptions.onStderr(line.trimEnd())));
}
}

Expand Down

0 comments on commit 9f99c1c

Please sign in to comment.