Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › zig › SubprocessCommand Public Struct SubprocessCommand Doc Source Public Struct std.zig.SubprocessCommand
pub const SubprocessCommand = struct Fields Functions File zig.zig: 1299
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327 pub const SubprocessCommand = struct {
argv : []const []const u8 ,
cwd : ?[]const u8 = null ,
parent_env : ?*const std .process .Environ .Map = null ,
child_env : ?*const std .process .Environ .Map = null ,
pub fn format (sc : SubprocessCommand , w : *Io .Writer ) Io .Writer .Error !void {
if (sc .cwd ) |path | {
try w .print ("cd {s} && " , .{path });
}
if (sc .child_env ) |child_env | {
for (child_env .keys (), child_env .values ()) |key , value | {
if (sc .parent_env ) |parent_env | {
if (parent_env .get (key )) |process_value | {
if (mem .eql (u8 , value , process_value )) continue ;
}
}
try w .print ("{s}=" , .{key });
try shellEscape (w , value , false );
try w .writeByte (' ' );
}
}
try shellEscape (w , sc .argv [0 ], true );
for (sc .argv [1 ..]) |arg | {
try w .writeByte (' ' );
try shellEscape (w , arg , false );
}
}
}