Skip to content

Commit

Permalink
CommandLine uses OutputListener
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesshore committed Feb 19, 2023
1 parent ecc0667 commit d75175f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/infrastructure/command_line.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// Copyright Titanium I.T. LLC.
import OutputTracker from "./output_tracker.js";
import EventEmitter from "node:events";

const OUTPUT_EVENT = "output";
import OutputListener from "./output_listener.js";

export default class CommandLine {

Expand All @@ -18,7 +15,7 @@ export default class CommandLine {

constructor(proc) {
this._process = proc;
this._emitter = new EventEmitter();
this._listener = new OutputListener();
}

args() {
Expand All @@ -27,11 +24,11 @@ export default class CommandLine {

writeOutput(text) {
this._process.stdout.write(text);
this._emitter.emit(OUTPUT_EVENT, text);
this._listener.emit(text);
}

trackOutput() {
return OutputTracker.create(this._emitter, OUTPUT_EVENT);
return this._listener.trackOutput();
}

}
Expand Down

0 comments on commit d75175f

Please sign in to comment.