generated from atls-lab/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync(yarn-run-utils): dependencies, adjustments
- Loading branch information
Showing
7 changed files
with
426 additions
and
415 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import type { Writable } from 'node:stream' | ||
import type { PassThrough } from 'node:stream' | ||
|
||
import { StreamOutput } from './stream.output.js' | ||
import { StreamOutput } from './stream.output.js' | ||
|
||
export class PassThroughRunContext { | ||
private readonly stdoutOutput = new StreamOutput() | ||
public readonly stdout: PassThrough | ||
|
||
private readonly stderrOutput = new StreamOutput() | ||
public readonly stderr: PassThrough | ||
|
||
public readonly stdout: Writable | ||
private readonly stdoutOutput = new StreamOutput() | ||
|
||
public readonly stderr | ||
private readonly stderrOutput = new StreamOutput() | ||
|
||
constructor() { | ||
this.stdout = this.stdoutOutput.stream | ||
this.stderr = this.stderrOutput.stream | ||
} | ||
|
||
get output() { | ||
get output(): string { | ||
return [this.stdoutOutput.data, this.stderrOutput.data].filter(Boolean).join('\n') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { PassThrough } from 'stream' | ||
import { PassThrough } from 'node:stream' | ||
|
||
export class StreamOutput { | ||
public readonly stream = new PassThrough() | ||
|
||
private chunks: Array<Buffer> = [] | ||
|
||
constructor() { | ||
this.stream.on('data', (chunk) => this.chunks.push(chunk)) | ||
this.stream.on('data', (chunk: Buffer) => this.chunks.push(chunk)) | ||
} | ||
|
||
get data() { | ||
get data(): string { | ||
return Buffer.concat(this.chunks).toString() | ||
} | ||
} |