Skip to content

Commit

Permalink
refactor: remove runner logic from getters
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Oct 3, 2024
1 parent 690754d commit a6d86cc
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,28 +388,15 @@ export class ProcessPromise extends Promise<ProcessOutput> {
}

get stdin(): Writable {
this.stdio('pipe')
this.run()
assert(this.child)
if (this.child.stdin == null)
throw new Error('The stdin of subprocess is null.')
return this.child.stdin
return this.child?.stdin!
}

get stdout(): Readable {
this.run()
assert(this.child)
if (this.child.stdout == null)
throw new Error('The stdout of subprocess is null.')
return this.child.stdout
return this.child?.stdout!
}

get stderr(): Readable {
this.run()
assert(this.child)
if (this.child.stderr == null)
throw new Error('The stderr of subprocess is null.')
return this.child.stderr
return this.child?.stderr!
}

get exitCode(): Promise<number | null> {
Expand Down

0 comments on commit a6d86cc

Please sign in to comment.