Skip to content

Commit

Permalink
proc.stdin must exist for BatchProcess to be ready
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Jan 26, 2020
1 parent 0a8e9aa commit 8bb708e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/BatchProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export class BatchProcess {
return (
this.currentTask == null &&
!this.startupTask.pending &&
this._endPromise == null
this._endPromise == null &&
this.proc != null &&
this.proc.stdin != null
)
}
get idle(): boolean {
Expand Down Expand Up @@ -140,18 +142,10 @@ export class BatchProcess {
// We're not going to run this.running() here, because BatchCluster will
// already have pruned the processes that have exitted unexpectedly just
// milliseconds ago.
if (this.currentTask != null) {
if (this._taskCount >= 0 && !this.ready) {
this.observer.onInternalError(
new Error(
`${this.name}.execTask(${task.command}): already working on ${this.currentTask}`
)
)
return false
}
if (this._endPromise != null) {
this.observer.onInternalError(
new Error(
`${this.name}.execTask(${task.command}): this process is ending/ended`
`${this.name}.execTask(${task.command}): not ready`
)
)
return false
Expand Down

0 comments on commit 8bb708e

Please sign in to comment.