Skip to content

Commit

Permalink
fix: only trim trailing whitespace in most cases
Browse files Browse the repository at this point in the history
  • Loading branch information
themightychris committed Dec 9, 2024
1 parent 0645b02 commit 340e250
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 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().trim().split(/\n/).forEach(line => logger.info(line)));
process.stderr.on('data', data => data.toString().trim().split(/\n/).forEach(line => logger.error(line)));
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())));
} else {
if (execOptions.onStdout) {
process.stdout.on('data', data => data.toString().trim().split(/\n/).forEach(line => execOptions.onStdout(line)));
process.stdout.on('data', data => data.toString().split(/\n/).forEach(line => execOptions.onStdout(line.trimEnd())));
}
if (execOptions.onStderr) {
process.stderr.on('data', data => data.toString().trim().split(/\n/).forEach(line => execOptions.onStderr(line)));
process.stderr.on('data', data => data.toString().split(/\n/).forEach(line => execOptions.onStderr(line.trimEnd())));
}
}

Expand Down Expand Up @@ -528,7 +528,7 @@ class Git {
}
}

resolve(stdout.trim());
resolve(stdout.trimEnd());
});
});
} else {
Expand All @@ -543,7 +543,7 @@ class Git {
}
}

resolve(stdout.trim());
resolve(stdout.trimEnd());
});
});
}
Expand Down

0 comments on commit 340e250

Please sign in to comment.