Skip to content

Commit

Permalink
Only trim end of stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
webpro committed Jul 6, 2021
1 parent 9c9215f commit 75d0c2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/shell.js
Expand Up @@ -54,16 +54,16 @@ class Shell {
execStringCommand(command, options, { isExternal }) {
return new Promise((resolve, reject) => {
const childProcess = sh.exec(command, { async: true }, (code, stdout, stderr) => {
stdout = stdout.toString().trim();
stdout = stdout.toString().trimEnd();
debug({ command, options, code, stdout, stderr });
if (code === 0) {
resolve(stdout);
} else {
reject(new Error(stderr || stdout));
}
});
childProcess.stdout.on('data', stdout => this.log.verbose(stdout.toString().trim(), { isExternal }));
childProcess.stderr.on('data', stderr => this.log.verbose(stderr.toString().trim(), { isExternal }));
childProcess.stdout.on('data', stdout => this.log.verbose(stdout.toString().trimEnd(), { isExternal }));
childProcess.stderr.on('data', stderr => this.log.verbose(stderr.toString().trimEnd(), { isExternal }));
});
}

Expand Down
2 changes: 1 addition & 1 deletion test/git.js
Expand Up @@ -240,7 +240,7 @@ test.serial('should return repo status', async t => {
sh.ShellString('line').toEnd('file1');
sh.ShellString('line').toEnd('file2');
sh.exec('git add file2');
t.is(await gitClient.status(), 'M file1\nA file2');
t.is(await gitClient.status(), ' M file1\nA file2');
});

test.serial('should reset files', async t => {
Expand Down

0 comments on commit 75d0c2f

Please sign in to comment.