@@ -52,7 +52,9 @@ follow-up PRs against this RFC.
5252 * [ std::env] (stub)
5353 * [ std::fs] (stub)
5454 * [ std::net] (stub)
55- * [ std::process] (stub)
55+ * [ std::process]
56+ * [ Command]
57+ * [ Child]
5658 * [ std::os]
5759 * [ Odds and ends]
5860 * [ The io prelude]
@@ -498,7 +500,65 @@ throughout IO, we can go on to explore the modules in detail.
498500### ` std::process `
499501[ std::process ] : #stdprocess
500502
501- > To be added in a follow-up PR.
503+ Currently ` std::io::process ` is used only for spawning new
504+ processes. The re-envisioned ` std::process ` will ultimately support
505+ inspecting currently-running processes, although this RFC does not
506+ propose any immediate support for doing so -- it merely future-proofs
507+ the module.
508+
509+ #### ` Command `
510+ [ Command ] : #command
511+
512+ The ` Command ` type is a builder API for processes, and is largely in
513+ good shape, modulo a few tweaks:
514+
515+ * Replace ` ToCCstr ` bounds with ` IntoOsStrBuf ` .
516+ * Replace ` env_set_all ` with ` env_clear `
517+ * Rename ` cwd ` to ` current_dir ` , take ` AsPath ` .
518+ * Rename ` spawn ` to ` run `
519+ * Move ` uid ` and ` gid ` to an extension trait in ` os::unix `
520+ * Make ` detached ` take a ` bool ` (rather than always setting the
521+ command to detached mode).
522+
523+ The ` stdin ` , ` stdout ` , ` stderr ` methods will undergo a more
524+ significant change. By default, the corresponding options we be
525+ considered "unset", the interpretation of which depends on how the
526+ process is launched:
527+
528+ * For ` run ` or ` status ` , these will inherit from the current process by default.
529+ * For ` output ` , these will capture to new readers/writers by default.
530+
531+ The ` StdioContainer ` type will be renamed to ` Stdio ` , and will not be
532+ exposed directly as an enum (to enable growth and change over time).
533+ It will provide a ` Capture ` constructor for capturing input or output,
534+ an ` Inherit ` constructor (which just means to use the current IO
535+ object -- it does not take an argument), and a ` Null ` constructor. The
536+ equivalent of today's ` InheritFd ` will be added at a later point.
537+
538+ #### ` Child `
539+ [ Child ] : #child
540+
541+ We propose renaming ` Process ` to ` Child ` so that we can add a
542+ more general notion of non-child ` Process ` later on (every
543+ ` Child ` will be able to give you a ` Process ` ).
544+
545+ * ` stdin ` , ` stdout ` and ` stderr ` will be retained as public fields,
546+ but their types will change to ` Box<Reader+Send> ` or
547+ ` Box<Writer+Send> ` as appropriate. This effectively hides the internal
548+ pipe infrastructure.
549+ * The ` kill ` method is dropped, and ` id ` and ` signal ` will move to ` os::platform ` extension traits.
550+ * ` signal_exit ` , ` signal_kill ` , ` wait ` , and ` forget ` will all stay as they are.
551+ * ` wait_with_output ` will take ` &self ` .
552+ * ` set_timeout ` will be changed to use the ` with_deadline ` infrastructure.
553+
554+ There are also a few other related changes to the module:
555+
556+ * Rename ` ProcessOuptput ` to ` Output `
557+ * Rename ` ProcessExit ` to ` ExitStatus ` , and hide its
558+ representation. Remove ` matches_exit_status ` , and add a ` status `
559+ method yielding an `Option<i32 >
560+ * Remove ` MustDieSignal ` , ` PleaseExitSignal ` .
561+ * Remove ` EnvMap ` (which should never have been exposed).
502562
503563### ` std::os `
504564[ std::os ] : #stdos
0 commit comments