Skip to content

Commit

Permalink
feat: add a newline after commands that don't end their output with one
Browse files Browse the repository at this point in the history
* Resolves google#776

Signed-off-by: chankruze <chankruze@gmail.com>
  • Loading branch information
chankruze committed May 16, 2024
1 parent 3d24076 commit ee85db8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,13 @@ export function log(entry: LogEntry) {
case 'stdout':
case 'stderr':
if (!entry.verbose) return
let lastChar = entry.data.toString('utf-8', entry.data.length - 1)
if (lastChar !== '\n') {
process.stdout.write(
Buffer.concat([entry.data, Buffer.from('\n', 'utf-8')])
)
break
}
process.stderr.write(entry.data)
break
case 'cd':
Expand Down

0 comments on commit ee85db8

Please sign in to comment.