Skip to content

Commit 79b39a5

Browse files
authored
Improve documentation of run(Cmd) (#57705)
This PR aims to make it clearer to new users how `run`, `wait`, and `Process::exitcode` all interact. This is a comment point of confusion for new users. It's a bit awkward having `Process` be a sort-of-internal data type, but then expecting users to use `Process::exitcode`. I think this PR at least makes the current situation clearer, and design changes can be left alone for now. Fix #57612.
1 parent 8b14690 commit 79b39a5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

base/process.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -500,12 +500,16 @@ exiting with a non-zero status (when `wait` is true).
500500
The `args...` allow you to pass through file descriptors to the command, and are ordered
501501
like regular unix file descriptors (eg `stdin, stdout, stderr, FD(3), FD(4)...`).
502502
503-
If `wait` is false, the process runs asynchronously. You can later wait for it and check
504-
its exit status by calling `success` on the returned process object.
503+
If `wait` is false, the process runs asynchronously. You can later [`wait`](@ref) for it
504+
and check its exit status by calling `success` on the returned process object. If the
505+
`command` spawns only a single process, a `Process` object is returned and the
506+
exit code can be retrieved via the `exitcode` field; see [`wait`](@ref) for more details.
505507
506508
When `wait` is false, the process' I/O streams are directed to `devnull`.
507509
When `wait` is true, I/O streams are shared with the parent process.
508510
Use [`pipeline`](@ref) to control I/O redirection.
511+
512+
See also: [`Cmd`](@ref).
509513
"""
510514
function run(cmds::AbstractCmd, args...; wait::Bool = true)
511515
if wait

0 commit comments

Comments
 (0)