Command always panicks

⚓ Rust    📅 2026-01-01    👤 surdeus    👁️ 1      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Command always panicks

How to fix it?

    Command::new("echo").arg("hello world").output().expect("Unable to run cmd");

this always returns:

thread 'main' (7448) panicked at src\main.rs:9:44:
Unable to run cmd: Error { kind: NotFound, message: "program not found" }
stack backtrace:
   0: std::panicking::panic_handler
             at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library\std\src\panicking.rs:698
   1: core::panicking::panic_fmt
             at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library\core\src\panicking.rs:80
   2: core::result::unwrap_failed
             at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library\core\src\result.rs:1862
   3: bbrotserver::main
   4: bbrotserver::main
   5: bbrotserver::main
   6: std::rt::lang_start_internal::closure$0
             at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library\std\src\rt.rs:175
   7: std::panicking::catch_unwind::do_call
             at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library\std\src\panicking.rs:590
   8: std::panicking::catch_unwind
             at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library\std\src\panicking.rs:553
   9: std::panic::catch_unwind
             at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library\std\src\
                                                                               \panic.rs:359
  10: std::rt::lang_start_internal
             at /rustc/ded5c06cf21d2b93bffd5d884aa6e96934ee4234/library\std\src\
                                                                               \rt.rs:171
  11: main
  12: invoke_main
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.
                                                                               .inl:78
  13: __scrt_common_main_seh
             at D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.
                                                                               .inl:288
  14: BaseThreadInitThunk
  15: RtlUserThreadStart
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose bac
                                                                               cktrace.

2 posts - 2 participants

Read full topic

🏷️ Rust_feed