#440

`zero run` on Windows reports "No such file or directory" when the program crashes

OpenU0001F3A2opened 24d ago

When the compiled program crashes on Windows, zero run prints zero run: No such file or directory and exits 1, which hides the crash.

v0.3.4 on Windows 11 x64:

pub fn main(world: World) -> Void raises {
    var values: [4]u32 = [1, 2, 3, 4]
    var index: usize = 4
    index = index + 1000
    let v: u32 = values[index]
    if v == 1 {
        check world.out.write("unreachable\n")
    }
    check world.out.write("after\n")
}
  • zero run . prints trap: index out of bounds, then zero run: No such file or directory, exit 1
  • the built .exe run from PowerShell exits with 0xC000001D

An i64 MIN / -1 program does the same (the .exe exits with 0xC0000095). On Linux, zero run passes these through as 132 and 136.

main.c:6346-6352 (identical at main.c:6051-6056 in v0.3.4) treats any negative _spawnv result as a launch failure and calls perror. An NTSTATUS code has the high bit set, so it likely comes back negative and perror prints a stale errno. I couldn't build main on Windows to confirm.

A fix would tell a launch failure apart from an abnormal child exit and print the status in hex. A Windows test for launch failure, normal exit and both crash cases would pin it.

Activity

0

No activity yet.