ltgcgo / wingblade

☁️ One codebase, multiple runtimes.
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Unified subprocess API #5

Open PoneyClairDeLune opened 1 year ago

PoneyClairDeLune commented 1 year ago
PoneyClairDeLune commented 1 month ago

First rough draft.

navigator.child

root

class {
    static? DITCH = 0; // "null"
    static? DISCARD = 0;
    static? TRASH = 0;
    static? NULL = 0;
    static? IGNORE = 0;
    static? THRU = 1; // "inherit"
    static? PASS = 1;
    static? THROUGH = 1;
    static? PASSTHRU = 1;
    static? PASSALONG = 1;
    static? PASSTHROUGH = 1;
    static? SINK = 2; // "pipe" or "piped"
    static? PIPED = 2;
    static? STREAM = 2;
    static? ACCEPT = 2;
    static? PROCESS = 2;
    static new(execPath, ?options);
    static spawn(execPath, ?options);
    static run(execPath, ?options);
    static runSync(execPath, ?options);
    spawn();
    run();
    runSync();
}

.new() / new navigator.child

Implements a variant of Deno.ChildProcess.

navigator.child.new(execPath, {
    ?args: [],
    ?env: {},
    ?pure: false, // clearEnv in Deno
    ?uid: ?0, // no equiv in Bun
    ?gid: ?0, // no equiv in Bun
    ?signal: AbortSignal, // no equiv in Bun
    ?runtimeNativeIPC: true, // no equiv in Deno
    ?stdin: 2,
    ?stdout: 2,
    ?stderr: 1,
    ?rawWindows: false // no equiv in Bun
});

The remaining definitions