Skip to content

Commit

Permalink
Ensure output from external transport applications is shown line by l…
Browse files Browse the repository at this point in the history
…ine.
  • Loading branch information
MatthiasDeFre committed Jun 24, 2024
1 parent 7b19e42 commit d175bf5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions transport/external_transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,21 @@ abstract class ExternalTransport implements Transport {
);

this.process.stdout.on("data", (data) => {
logger.debug("SFU", this.id, "stdout:", data);
const lines = data.toString().split(/[\r\n]+/)
for(const line of lines) {
if(line.length > 0) { // Don't include empty new lines created by e.g. println
logger.debug("SFU", this.id, "stdout:", line);
}
}
});

this.process.stderr.on("data", (data) => {
logger.debug("SFU", this.id, "stderr:", data);
const lines = data.toString().split(/[\r\n]+/)
for(const line of lines) {
if(line.length > 0) { // Don't include empty new lines created by e.g. println
logger.debug("SFU", this.id, "stderr:", line);
}
}
});

this.process.on("error", (err) => {
Expand Down

0 comments on commit d175bf5

Please sign in to comment.