Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Ensure log messages end with new line
Browse files Browse the repository at this point in the history
  • Loading branch information
saitho committed Dec 21, 2019
1 parent ddc566d commit 4ed5e97
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,12 @@ export class Cli implements CliInterface {
}

public initEmitter(emitter: EventEmitter) {
emitter.on('log', process.stdout.write.bind(process.stdout));
emitter.on('error', process.stderr.write.bind(process.stderr));
emitter.on('log', (args: string) => {
return process.stdout.write.bind(process.stdout)(args + "\n");
});
emitter.on('error', (args: string) => {
return process.stderr.write.bind(process.stderr)(args + "\n");
});
emitter.on('help', (data: any) => emitter.emit('log', data));
}

Expand Down Expand Up @@ -121,6 +125,6 @@ export class Cli implements CliInterface {
return;
}
commands[requestedCommand].run()
.catch((error) => this.emitter.emit('error', error.toString() + "\n"));
.catch((error) => this.emitter.emit('error', error.toString()));
}
}

0 comments on commit 4ed5e97

Please sign in to comment.