dsherret / dax

Cross-platform shell tools for Deno and Node.js inspired by zx.
MIT License
1.02k stars 34 forks source link

Panic on stderr redirect #205

Closed matklad closed 8 months ago

matklad commented 9 months ago

Good:

await $`./zig/zig > log.vopr`

error: Uncaught (in promise) Error: Redirects are not supported. Pipe in the JS code instead using the methods on commands.
    throw new Error("Redirects are not supported. Pipe in the JS code instead using the methods on commands.");
          ^
    at executeCommand (https://deno.land/x/dax@0.36.0/src/shell.ts:540:11)
    at executePipelineInner (https://deno.land/x/dax@0.36.0/src/shell.ts:532:14)
    at executePipeline (https://deno.land/x/dax@0.36.0/src/shell.ts:432:10)
    at executeSequence (https://deno.land/x/dax@0.36.0/src/shell.ts:416:14)
    at executeSequentialList (https://deno.land/x/dax@0.36.0/src/shell.ts:387:26)
    at spawn (https://deno.land/x/dax@0.36.0/src/shell.ts:376:24)
    at CommandChild.pipedStdoutBuffer (https://deno.land/x/dax@0.36.0/src/command.ts:616:24)
    at new Promise (<anonymous>)
    at new CommandChild (https://deno.land/x/dax@0.36.0/src/command.ts:502:5)
    at parseAndSpawnCommand (https://deno.land/x/dax@0.36.0/src/command.ts:612:10)

Not Good:

await $`./zig/zig 2> log.vopr`

panicked at src/rs_lib/src/lib.rs:17:56:
called `Result::unwrap()` on an `Err` value: Error(JsValue(Error: cannot serialize tagged newtype variant RedirectFd::Fd containing an integer
Error: cannot serialize tagged newtype variant RedirectFd::Fd containing an integer
    at __wbindgen_error_new (https://deno.land/x/dax@0.36.0/src/lib/rs_lib.generated.js:391:19)
    at serde_wasm_bindgen::error::Error::new::he97741370b1073bd (wasm://wasm/000b8bb6:1:122046)
    at <serde_wasm_bindgen::ser::ObjectSerializer as serde::ser::SerializeStruct>::serialize_field::h3e2f9d4f0bfa4832 (wasm://wasm/000b8bb6:1:85711)
    at <serde_wasm_bindgen::ser::ObjectSerializer as serde::ser::SerializeStruct>::serialize_field::h6f96690011782ca6 (wasm://wasm/000b8bb6:1:75964)
    at <serde_wasm_bindgen::ser::ObjectSerializer as serde::ser::SerializeStruct>::serialize_field::hca4f6eb371d12fa9 (wasm://wasm/000b8bb6:1:70111)
    at <serde_wasm_bindgen::ser::ObjectSerializer as serde::ser::SerializeStruct>::serialize_field::hd83e873fd5938f1c (wasm://wasm/000b8bb6:1:106459)
    at deno_task_shell::parser::_::<impl serde::ser::Serialize for deno_task_shell::parser::SequentialList>::serialize::hc2e42c5048623cf5 (wasm://wasm/000b8bb6:1:115069)
    at parse (wasm://wasm/000b8bb6:1:53797)
    at Object.parse (https://deno.land/x/dax@0.36.0/src/lib/rs_lib.generated.js:215:10)
    at parseCommand (https://deno.land/x/dax@0.36.0/src/shell.ts:350:23)))

Stack:

Error
    at __wbg_new_abda76e883ba8a5f (https://deno.land/x/dax@0.36.0/src/lib/rs_lib.generated.js:458:19)
    at console_error_panic_hook::hook::hcb49fd7b293342fa (wasm://wasm/000b8bb6:1:84105)
    at std::panicking::rust_panic_with_hook::h3aa054d35a0817d7 (wasm://wasm/000b8bb6:1:107759)
    at std::panicking::begin_panic_handler::{{closure}}::h2f73e4cf6cd6319a (wasm://wasm/000b8bb6:1:109904)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h98ac61a6abbff7e9 (wasm://wasm/000b8bb6:1:128129)
    at rust_begin_unwind (wasm://wasm/000b8bb6:1:121141)
    at core::panicking::panic_fmt::h3e1dd3d08288569e (wasm://wasm/000b8bb6:1:122504)
    at core::result::unwrap_failed::h8b3db0f11171b57b (wasm://wasm/000b8bb6:1:113822)
    at core::result::Result<T,E>::unwrap::h3da1b482fe3f3034 (wasm://wasm/000b8bb6:1:122126)
    at parse (wasm://wasm/000b8bb6:1:53815)

error: Uncaught (in promise) RuntimeError: unreachable
    at rust_panic (wasm://wasm/000b8bb6:1:128157)
    at std::panicking::rust_panic_with_hook::h3aa054d35a0817d7 (wasm://wasm/000b8bb6:1:107799)
    at std::panicking::begin_panic_handler::{{closure}}::h2f73e4cf6cd6319a (wasm://wasm/000b8bb6:1:109904)
    at std::sys_common::backtrace::__rust_end_short_backtrace::h98ac61a6abbff7e9 (wasm://wasm/000b8bb6:1:128129)
    at rust_begin_unwind (wasm://wasm/000b8bb6:1:121141)
    at core::panicking::panic_fmt::h3e1dd3d08288569e (wasm://wasm/000b8bb6:1:122504)
    at core::result::unwrap_failed::h8b3db0f11171b57b (wasm://wasm/000b8bb6:1:113822)
    at core::result::Result<T,E>::unwrap::h3da1b482fe3f3034 (wasm://wasm/000b8bb6:1:122126)
    at parse (wasm://wasm/000b8bb6:1:53815)
    at Object.parse (https://deno.land/x/dax@0.36.0/src/lib/rs_lib.generated.js:215:10)