wasmer icon indicating copy to clipboard operation
wasmer copied to clipboard

Wasix subprocess example on Windows crashes without any output

Open andrzejressel opened this issue 1 year ago • 2 comments

Describe the bug

Running subprocess wasix example on Windows does not output anything.

PS C:\wasix-rust-examples\wasix-subprocess> wasmer -vV
wasmer 4.2.5 (0460050 2023-12-23)
binary: wasmer-cli
commit-hash: 04600507844bae978239531c8e6265d410aefe6d
commit-date: 2023-12-23
host: x86_64-pc-windows-msvc
compiler: singlepass,cranelift,llvm
PS C:\wasix-rust-examples\wasix-subprocess> rustc -vV
rustc 1.74.0 (79e9716c9 2023-11-13)
binary: rustc
commit-hash: 79e9716c980570bfd1f666e3b16ac583f0168962
commit-date: 2023-11-13
host: x86_64-pc-windows-msvc
release: 1.74.0
LLVM version: 17.0.4

Steps to reproduce

  1. Clone https://github.com/wasix-org/wasix-rust-examples
  2. Open wasix-subprocess in terminal
  3. Run cargo wasix build --release
  4. Run wasmer run .

Expected behavior

Either ls outputs something or crash with visible stacktrace

Actual behavior

Nothing

PS C:\wasix-rust-examples\wasix-subprocess> wasmer run .
PS C:\wasix-rust-examples\wasix-subprocess> wasmer run .
PS C:\wasix-rust-examples\wasix-subprocess> wasmer run .
PS C:\wasix-rust-examples\wasix-subprocess> wasmer run .
PS C:\wasix-rust-examples\wasix-subprocess> wasmer run .

Additional context

I'm sure it crashes, because after adding some debug printlns

use std::process::Command;

fn main() {
    std::env::set_var("PATH", "/bin");

    let mut cmd = Command::new("ls");
    cmd.arg("-l");

    println!("TEST1");
    let output = cmd.output();
    println!("TEST2");
}

Output is

PS C:\wasix-rust-examples\wasix-subprocess> wasmer run .
TEST1

andrzejressel avatar Jan 14 '24 14:01 andrzejressel

Hey @andrzejressel, by default the commands available will be added in the /bin directory depending on the Wasmer dependencies. To be able to call ls, your program will need to add the sharrattj/coreutils dependency in wasmer.toml.

Although it seems that your command should either print an error or succeed, but is doing neither, so we need to investigate further in any case.

Would you mind sharing the wasix-subprocess repository so we can also check the wasmer.toml file used? Thanks!

syrusakbary avatar Jan 16 '24 09:01 syrusakbary