superqemu/src/ProcessInterface.ts
modeco80 adcefd76ef retool QemuVM to use the process launcher interface
Relatively easy since we basically comform to a subset of execa anyways.
2024-11-02 03:00:51 -04:00

37 lines
No EOL
782 B
TypeScript

import {type Stream, EventEmitter, Readable, Writable} from 'node:stream';
export type StdioOption =
| 'pipe'
| 'overlapped'
| 'ipc'
| 'ignore'
| 'inherit'
| Stream
| number
| undefined;
// subset of options. FIXME: Add more!!!
export interface ProcessLaunchOptions {
stdin?: StdioOption,
stdout?: StdioOption,
stderr?: StdioOption
}
export interface IProcess extends EventEmitter {
stdin: Writable | null;
stdout: Readable | null;
stderr: Readable | null;
// Escape hatch; only use this if you have no choice
//native() : any;
kill(signal?: number | NodeJS.Signals): boolean;
dispose(): void;
}
// Launches a processs.
export interface IProcessLauncher {
launch(command: string, opts?: ProcessLaunchOptions) : IProcess;
}