dsherret / dax

Cross-platform shell tools for Deno and Node.js inspired by zx.
MIT License
1.02k stars 34 forks source link

refactor(BREAKING): command pipe writes may now return a promise #225

Closed dsherret closed 8 months ago

dsherret commented 8 months ago

Before:

export interface CommandPipeWriter extends WriterSync {
  writeSync(p: Uint8Array): number;
  writeText(text: string): void;
  writeLine(text: string): void;
}

After:

export interface CommandPipeWriter {
  write(p: Uint8Array): Promise<number> | number;
  writeText(text: string): Promise<void> | void;
  writeLine(text: string): Promise<void> | void;
}

For performance, check if the write in a command returns a promise. If it does, then continue async, otherwise continue sync.

Closes https://github.com/dsherret/dax/issues/224