aboutsummaryrefslogtreecommitdiff
path: root/lib/std/process/Child.zig
AgeCommit message (Collapse)Author
2025-10-29std.Io.Threaded: add ioBasic which disables networkingAndrew Kelley
2025-10-29std.process.Child: update for std.Io changesAndrew Kelley
2025-10-29fix compilation errors introduced by rebasingAndrew Kelley
2025-10-29std: updating to std.Io interfaceAndrew Kelley
got the build runner compiling
2025-10-10replaced https://simonsapin.github.io/wtf-8/ with https://wtf-8.codeberg.page/usebeforefree
2025-09-24std: always allow spawning processes when an env map is explicitly provided ↵Carter Snook
(#25092) In a library, the two `builtin.link_libc` and `builtin.output_mode == .Exe` checks could both be false. Thus, you would get a compile error even if you specified an `env_map` at runtime. This change turns the compile error into a runtime panic and updates the documentation to reflect the runtime requirement.
2025-09-19std.fmt: migrate bufPrintZ to bufPrintSentinel (#25260)John Benediktsson
2025-08-16Compilation: remove last instance of deprecatedReaderAndrew Kelley
This also makes initStreaming preemptively disable file size checking.
2025-08-11std.ArrayList: make unmanaged the defaultAndrew Kelley
2025-07-26std.process.Child: fix double path normalization in spawnWindowslumanetic
besides simply being redundant work, the now removed normalize call would cause spawn to errantly fail (BadPath) when passing a relative path which traversed 'above' the current working directory. This case is already handled by leaving normalization to the windows.wToPrefixedFileW call in windowsCreateProcessPathExt
2025-07-23std.Io.poll: update to new I/O APIAndrew Kelley
2025-07-07std.fmt: breaking API changesAndrew Kelley
added adapter to AnyWriter and GenericWriter to help bridge the gap between old and new API make std.testing.expectFmt work at compile-time std.fmt no longer has a dependency on std.unicode. Formatted printing was never properly unicode-aware. Now it no longer pretends to be. Breakage/deprecations: * std.fs.File.reader -> std.fs.File.deprecatedReader * std.fs.File.writer -> std.fs.File.deprecatedWriter * std.io.GenericReader -> std.io.Reader * std.io.GenericWriter -> std.io.Writer * std.io.AnyReader -> std.io.Reader * std.io.AnyWriter -> std.io.Writer * std.fmt.format -> std.fmt.deprecatedFormat * std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape * std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape * std.fmt.fmtSliceHexLower -> {x} * std.fmt.fmtSliceHexUpper -> {X} * std.fmt.fmtIntSizeDec -> {B} * std.fmt.fmtIntSizeBin -> {Bi} * std.fmt.fmtDuration -> {D} * std.fmt.fmtDurationSigned -> {D} * {} -> {f} when there is a format method * format method signature - anytype -> *std.io.Writer - inferred error set -> error{WriteFailed} - options -> (deleted) * std.fmt.Formatted - now takes context type explicitly - no fmt string
2025-03-25support more process creation options on WindowsJonathan Marler
Adds a CreateProcessFlags packed struct for all the possible flags to CreateProcessW on windows. In addition, propagates the existing `start_suspended` option in std.process.Child which was previously only used on Darwin. Also adds a `create_no_window` option to std.process.Child which is a commonly used flag for launching console executables on windows without causing a new console window to "pop up".
2025-03-24windows: Use AccessDenied for ACCESS_DENIED on WindowsPat Tullmann
Windows defines an `ACCESS_DENIED` error code. There is no PERMISSION_DENIED (or its equivalent) which seems to only exist on POSIX systems. Fix a couple Windows calls code to return `error.AccessDenied` for `ACCESS_DENIED` and to stop mapping AccessDenied into PermissionDenied.
2025-02-03process.Child.collectOutput: Switch to Allocator/ArrayListUnmanagedRyan Liptak
Removes an inadvisable comparison of Allocator.ptr fields
2025-01-31std: don't leak a process in Child.run in case of an errorAlex Kladov
Closes: #22433
2025-01-20std.process.Child: add `waitForSpawn`mlugg
`std.Build.Step.Run` makes the very reasonable assumption that `error.InvalidExe` will be reported on `spawn` if it will happen. However, this property does not currently hold on POSIX targets. This is, through a slightly convoluted series of events, partially responsible for the sporadic `BrokenPipe` errors we've been seeing more and more in CI runs. Making `spawn` wait for the child to exec in the POSIX path introduces a block of up to 400us. So, instead of doing that, we add a new API for this particular case: `waitForSpawn`. This function is a nop on Windows, but on POSIX it blocks until the child successfully (or otherwise) calls `execvpe`, and reports the error if necessary. `std.Build.Step.Run` calls this function, so that it can get `error.InvalidExe` when it wants it. I'm not convinced that this API is optimal. However, I think this entire API needs to be either heavily refactored or straight-up redesigned (related: #22504), so I'm not too worried about hitting the perfect API: I'd rather just fix this bug for now, and figure out the long-term goal a bit later.
2024-11-27std.os.windows: Map PIPE_NOT_AVAILABLE from OpenFile() to error.NoDevice ↵Justin Braben
(#21938)
2024-11-25std.process.Child: explicit error set for waitAndrew Kelley
2024-09-24fix IB in fifoToOwnedArrayListAlex Kladov
memcpy requires non-overlapping arguments. fifo.realign() handles this case correctly and tries to provide an optimized implementation. This probably wasn't hit in practice, as, in a typical usage, fifo's head is not advanced.
2024-09-12Replace deprecated default initializations with decl literalsLinus Groh
2024-08-28std: update `std.builtin.Type` fields to follow naming conventionsmlugg
The compiler actually doesn't need any functional changes for this: Sema does reification based on the tag indices of `std.builtin.Type` already! So, no zig1.wasm update is necessary. This change is necessary to disallow name clashes between fields and decls on a type, which is a prerequisite of #9938.
2024-07-22Allow setting PGID in std.process.Child.spawnNguyễn Gia Phong
2024-07-15Better implementation of GetLastError. (#20623)Lucas Santos
Instead of calling the dynamically loaded kernel32.GetLastError, we can extract it from the TEB. As shown by [Wine](https://github.com/wine-mirror/wine/blob/34b1606019982b71818780bc84b76460f650af31/include/winternl.h#L439), the last error lives at offset 0x34 of the TEB in 32-bit Windows and at offset 0x68 in 64-bit Windows.
2024-06-21std.Build.findProgram(): Try with and without the Windows executable extensions.Alex Rønne Petersen
I renamed std.process.Child.CreateProcessSupportedExtension to WindowsExtension and made it public to avoid duplicating the list of extensions. While here, I also improved it to not misreport OOM from std.fs.realpathAlloc() as a generic failure to find the program, but instead panic like the rest of the build system does for OOM. Closes #20314.
2024-06-16std.process.Child: `run` fn accepts std.Progress.NodeAndrew Kelley
There was not a way to pass a progress node to this function until now.
2024-05-27std.process.Child: fix spawning child proc with new cwd fdAndrew Kelley
Before this fix, the dup2 of the progress pipe was clobbering the cwd fd, causing the fchdir to return ENOTDIR in between fork() and exec().
2024-05-27std.process.Child: comptime assert to protect prog_filenoAndrew Kelley
documenting my assumptions via comptime assertion
2024-05-27std.process.Child: prevent racing children from inheriting progress pipesmlugg
This fix is already in master branch for stdin, stdout, and stderr; this commit solves the same problem but for the progress pipe. Both fixes were originally included in one commit on this branch, however it was split it into two so that master branch could receive the fix before the progress branch is merged.
2024-05-27std.process.Child: fix ZIG_PROGRESS env var handlingAndrew Kelley
and properly dup2 the file descriptor to make it handle the case when other files are already open
2024-05-27std.Progress: include subtrees from child processesAndrew Kelley
2024-05-27std.Progress: child process sends updates via IPCAndrew Kelley
2024-05-26std.process.Child: prevent racing children from inheriting one another's pipesMatthew Lugg
The added comment explains the issue here relatively well. The new progress API made this bug obvious because it became visibly clear that certain Compile steps were seemingly "hanging" until other steps completed. As it turned out, these child processes had raced to spawn, and hence one had inherited the other's stdio pipes, meaning the `poll` call in `std.Build.Step.evalZigProcess` was not identifying the child stdout as closed until an unrelated process terminated.
2024-05-26std.process.Child: Improve doc comments of Windows argv -> command line ↵Ryan Liptak
functions
2024-05-26std: restructure child process namespaceAndrew Kelley