diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-01-05 19:16:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-05 12:16:46 +0100 |
commit | c823211a2cae13ff6fdb7d3d3fc585bb4e096232 (patch) | |
tree | 0c33314357cfaa8fe622a0ff85ccc1694e67ddf5 /std/wasi/snapshot_preview1.ts | |
parent | 37a9d6678ed4f634100d4b6ecb5abd7b0b45faad (diff) |
feat(std/wasi): allow stdio resources to be specified (#8999)
Diffstat (limited to 'std/wasi/snapshot_preview1.ts')
-rw-r--r-- | std/wasi/snapshot_preview1.ts | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/std/wasi/snapshot_preview1.ts b/std/wasi/snapshot_preview1.ts index bc63e82dd..b3d5274e6 100644 --- a/std/wasi/snapshot_preview1.ts +++ b/std/wasi/snapshot_preview1.ts @@ -306,6 +306,21 @@ export interface ContextOptions { * Determines if calls to exit from within the WebAssembly module will terminate the proess or return. */ exitOnReturn?: boolean; + + /** + * The resource descriptor used as standard input in the WebAssembly module. + */ + stdin?: number; + + /** + * The resource descriptor used as standard output in the WebAssembly module. + */ + stdout?: number; + + /** + * The resource descriptor used as standard error in the WebAssembly module. + */ + stderr?: number; } /** @@ -335,17 +350,17 @@ export default class Context { this.fds = [ { - rid: Deno.stdin.rid, + rid: options.stdin ?? Deno.stdin.rid, type: FILETYPE_CHARACTER_DEVICE, flags: FDFLAGS_APPEND, }, { - rid: Deno.stdout.rid, + rid: options.stdout ?? Deno.stdout.rid, type: FILETYPE_CHARACTER_DEVICE, flags: FDFLAGS_APPEND, }, { - rid: Deno.stderr.rid, + rid: options.stderr ?? Deno.stderr.rid, type: FILETYPE_CHARACTER_DEVICE, flags: FDFLAGS_APPEND, }, |