@@ -1028,7 +1028,9 @@ fn runCommand(
1028
1028
var interp_argv = std .ArrayList ([]const u8 ).init (b .allocator );
1029
1029
defer interp_argv .deinit ();
1030
1030
1031
- const result = spawnChildAndCollect (run , argv , has_side_effects , prog_node , fuzz_context ) catch | err | term : {
1031
+ var env_map = run .env_map orelse & b .graph .env_map ;
1032
+
1033
+ const result = spawnChildAndCollect (run , argv , env_map , has_side_effects , prog_node , fuzz_context ) catch | err | term : {
1032
1034
// InvalidExe: cpu arch mismatch
1033
1035
// FileNotFound: can happen with a wrong dynamic linker path
1034
1036
if (err == error .InvalidExe or err == error .FileNotFound ) interpret : {
@@ -1061,6 +1063,15 @@ fn runCommand(
1061
1063
if (b .enable_wine ) {
1062
1064
try interp_argv .append (bin_name );
1063
1065
try interp_argv .appendSlice (argv );
1066
+
1067
+ // Wine's excessive stderr logging is only situationally helpful. Disable it by default, but
1068
+ // allow the user to override it (e.g. with `WINEDEBUG=err+all`) if desired.
1069
+ if (env_map .get ("WINEDEBUG" ) == null ) {
1070
+ // We don't own `env_map` at this point, so turn it into a copy before modifying it.
1071
+ env_map = b .allocator .create (EnvMap ) catch @panic ("OOM" );
1072
+ env_map .hash_map = try env_map .hash_map .cloneWithAllocator (arena );
1073
+ try env_map .put ("WINEDEBUG" , "-all" );
1074
+ }
1064
1075
} else {
1065
1076
return failForeign (run , "-fwine" , argv [0 ], exe );
1066
1077
}
@@ -1156,7 +1167,7 @@ fn runCommand(
1156
1167
1157
1168
try Step .handleVerbose2 (step .owner , cwd , run .env_map , interp_argv .items );
1158
1169
1159
- break :term spawnChildAndCollect (run , interp_argv .items , has_side_effects , prog_node , fuzz_context ) catch | e | {
1170
+ break :term spawnChildAndCollect (run , interp_argv .items , env_map , has_side_effects , prog_node , fuzz_context ) catch | e | {
1160
1171
if (! run .failing_to_execute_foreign_is_an_error ) return error .MakeSkipped ;
1161
1172
1162
1173
return step .fail ("unable to spawn interpreter {s}: {s}" , .{
@@ -1339,6 +1350,7 @@ const ChildProcResult = struct {
1339
1350
fn spawnChildAndCollect (
1340
1351
run : * Run ,
1341
1352
argv : []const []const u8 ,
1353
+ env_map : * EnvMap ,
1342
1354
has_side_effects : bool ,
1343
1355
prog_node : std.Progress.Node ,
1344
1356
fuzz_context : ? FuzzContext ,
@@ -1355,7 +1367,7 @@ fn spawnChildAndCollect(
1355
1367
if (run .cwd ) | lazy_cwd | {
1356
1368
child .cwd = lazy_cwd .getPath2 (b , & run .step );
1357
1369
}
1358
- child .env_map = run . env_map orelse & b . graph . env_map ;
1370
+ child .env_map = env_map ;
1359
1371
child .request_resource_usage_statistics = true ;
1360
1372
1361
1373
child .stdin_behavior = switch (run .stdio ) {
0 commit comments