[nix-shell:~/Downloads/zig/build]$ ./zig test ../test/stage1/behavior.zig -target i386-windows-msvc
Created /home/andy/Downloads/zig/build/zig-cache/o/McIyD3Bm3f2jqnD53lAAfZKU-VZa5xY2iE0HA8xJQXJH_WEcw1-0xa3kBwVYa6uL/test.exe but skipping execution because it is non-native.
[nix-shell:~/Downloads/zig/build]$ wine /home/andy/Downloads/zig/build/zig-cache/o/McIyD3Bm3f2jqnD53lAAfZKU-VZa5xY2iE0HA8xJQXJH_WEcw1-0xa3kBwVYa6uL/test.exe
Test [1/926] behavior.align.test "global variable alignment"...reached unreachable code
/home/andy/Downloads/zig/lib/std/progress.zig:170:36: 0x4781c7 in std.progress.Progress::std.progress.Progress.refresh (test.obj)
Panicked during a panic. Aborting.
The code in question is:
if (windows.kernel32.FillConsoleOutputAttribute(
file.handle,
info.wAttributes,
fill_chars,
cursor_pos,
&written,
) != windows.TRUE) unreachable;
It's hitting the unreachable there. GetLastError() is returning "invalid handle".
cc @LemonBoy
cc @alexnask
Happens for -target x86_64-windows-msvc as well.
If the code works under Windows the problem is in Wine implementation of the terminal API
The code works on windows in cmd.exe, ConEmu and the git bash console for both targets, not sure why wine fails.