fix(cli/js/process): Strengthen socket types based on pipes (#4836)

This commit is contained in:
Nayeem Rahman 2020-06-09 12:18:18 +01:00 committed by GitHub
parent 54742d29dc
commit b3e189ee4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 61 additions and 54 deletions

View file

@ -1741,12 +1741,12 @@ declare namespace Deno {
options?: { recursive: boolean }
): AsyncIterableIterator<FsEvent>;
export class Process {
export class Process<T extends RunOptions = RunOptions> {
readonly rid: number;
readonly pid: number;
readonly stdin?: Writer & Closer;
readonly stdout?: Reader & Closer;
readonly stderr?: Reader & Closer;
readonly stdin: T["stdin"] extends "piped" ? Writer & Closer : null;
readonly stdout: T["stdout"] extends "piped" ? Reader & Closer : null;
readonly stderr: T["stderr"] extends "piped" ? Reader & Closer : null;
/** Resolves to the current status of the process. */
status(): Promise<ProcessStatus>;
/** Buffer the stdout until EOF and return it as `Uint8Array`.
@ -1829,7 +1829,7 @@ declare namespace Deno {
* Details of the spawned process are returned.
*
* Requires `allow-run` permission. */
export function run(opt: RunOptions): Process;
export function run<T extends RunOptions = RunOptions>(opt: T): Process<T>;
interface InspectOptions {
depth?: number;