diff options
author | Jakub Łabor <jacob.labor@gmail.com> | 2022-10-07 14:38:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-07 14:38:06 +0200 |
commit | 7c3df66be77df98a46549e72ba4a07d8b06ed6c3 (patch) | |
tree | 1aeb5f49852964f83323996d50b75133aa525f34 /runtime/ops | |
parent | a5d55fe6eaa9ba32908cdff5a88215dd2466d415 (diff) |
feat(core): Reorder extension initialization (#16136)
Diffstat (limited to 'runtime/ops')
-rw-r--r-- | runtime/ops/io.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime/ops/io.rs b/runtime/ops/io.rs index ce2ed252f..18c7fb5e5 100644 --- a/runtime/ops/io.rs +++ b/runtime/ops/io.rs @@ -124,7 +124,8 @@ pub fn init_stdio(stdio: Stdio) -> Extension { .take() .expect("Extension only supports being used once."); let t = &mut state.resource_table; - t.add(StdFileResource::stdio( + + let rid = t.add(StdFileResource::stdio( match stdio.stdin { StdioPipe::Inherit => StdFileResourceInner { kind: StdFileResourceKind::Stdin, @@ -134,7 +135,9 @@ pub fn init_stdio(stdio: Stdio) -> Extension { }, "stdin", )); - t.add(StdFileResource::stdio( + assert_eq!(rid, 0, "stdin must have ResourceId 0"); + + let rid = t.add(StdFileResource::stdio( match stdio.stdout { StdioPipe::Inherit => StdFileResourceInner { kind: StdFileResourceKind::Stdout, @@ -144,7 +147,9 @@ pub fn init_stdio(stdio: Stdio) -> Extension { }, "stdout", )); - t.add(StdFileResource::stdio( + assert_eq!(rid, 1, "stdout must have ResourceId 1"); + + let rid = t.add(StdFileResource::stdio( match stdio.stderr { StdioPipe::Inherit => StdFileResourceInner { kind: StdFileResourceKind::Stderr, @@ -154,6 +159,7 @@ pub fn init_stdio(stdio: Stdio) -> Extension { }, "stderr", )); + assert_eq!(rid, 2, "stderr must have ResourceId 2"); Ok(()) }) .build() |