@@ -1079,7 +1079,9 @@ fn runCommand(
1079
1079
var interp_argv = std .ArrayList ([]const u8 ).init (b .allocator );
1080
1080
defer interp_argv .deinit ();
1081
1081
1082
- const result = spawnChildAndCollect (run , argv , has_side_effects , prog_node , fuzz_context ) catch | err | term : {
1082
+ var env_map = run .env_map orelse & b .graph .env_map ;
1083
+
1084
+ const result = spawnChildAndCollect (run , argv , env_map , has_side_effects , prog_node , fuzz_context ) catch | err | term : {
1083
1085
// InvalidExe: cpu arch mismatch
1084
1086
// FileNotFound: can happen with a wrong dynamic linker path
1085
1087
if (err == error .InvalidExe or err == error .FileNotFound ) interpret : {
@@ -1112,6 +1114,15 @@ fn runCommand(
1112
1114
if (b .enable_wine ) {
1113
1115
try interp_argv .append (bin_name );
1114
1116
try interp_argv .appendSlice (argv );
1117
+
1118
+ // Wine's excessive stderr logging is only situationally helpful. Disable it by default, but
1119
+ // allow the user to override it (e.g. with `WINEDEBUG=err+all`) if desired.
1120
+ if (env_map .get ("WINEDEBUG" ) == null ) {
1121
+ // We don't own `env_map` at this point, so turn it into a copy before modifying it.
1122
+ env_map = arena .create (EnvMap ) catch @panic ("OOM" );
1123
+ env_map .hash_map = try env_map .hash_map .cloneWithAllocator (arena );
1124
+ try env_map .put ("WINEDEBUG" , "-all" );
1125
+ }
1115
1126
} else {
1116
1127
return failForeign (run , "-fwine" , argv [0 ], exe );
1117
1128
}
@@ -1207,7 +1218,7 @@ fn runCommand(
1207
1218
1208
1219
try Step .handleVerbose2 (step .owner , cwd , run .env_map , interp_argv .items );
1209
1220
1210
- break :term spawnChildAndCollect (run , interp_argv .items , has_side_effects , prog_node , fuzz_context ) catch | e | {
1221
+ break :term spawnChildAndCollect (run , interp_argv .items , env_map , has_side_effects , prog_node , fuzz_context ) catch | e | {
1211
1222
if (! run .failing_to_execute_foreign_is_an_error ) return error .MakeSkipped ;
1212
1223
1213
1224
return step .fail ("unable to spawn interpreter {s}: {s}" , .{
@@ -1390,6 +1401,7 @@ const ChildProcResult = struct {
1390
1401
fn spawnChildAndCollect (
1391
1402
run : * Run ,
1392
1403
argv : []const []const u8 ,
1404
+ env_map : * EnvMap ,
1393
1405
has_side_effects : bool ,
1394
1406
prog_node : std.Progress.Node ,
1395
1407
fuzz_context : ? FuzzContext ,
@@ -1406,7 +1418,7 @@ fn spawnChildAndCollect(
1406
1418
if (run .cwd ) | lazy_cwd | {
1407
1419
child .cwd = lazy_cwd .getPath2 (b , & run .step );
1408
1420
}
1409
- child .env_map = run . env_map orelse & b . graph . env_map ;
1421
+ child .env_map = env_map ;
1410
1422
child .request_resource_usage_statistics = true ;
1411
1423
1412
1424
child .stdin_behavior = switch (run .stdio ) {
0 commit comments