@@ -60,25 +60,13 @@ cfg_if::cfg_if! {
60
60
////////////////////////////////////////////////////////////////////////////////
61
61
62
62
pub struct Command {
63
- // Currently we try hard to ensure that the call to `.exec()` doesn't
64
- // actually allocate any memory. While many platforms try to ensure that
65
- // memory allocation works after a fork in a multithreaded process, it's
66
- // been observed to be buggy and somewhat unreliable, so we do our best to
67
- // just not do it at all!
68
- //
69
- // Along those lines, the `argv` and `envp` raw pointers here are exactly
70
- // what's gonna get passed to `execvp`. The `argv` array starts with the
71
- // `program` and ends with a NULL, and the `envp` pointer, if present, is
72
- // also null-terminated.
73
- //
74
- // Right now we don't support removing arguments, so there's no much fancy
75
- // support there, but we support adding and removing environment variables,
76
- // so a side table is used to track where in the `envp` array each key is
77
- // located. Whenever we add a key we update it in place if it's already
78
- // present, and whenever we remove a key we update the locations of all
79
- // other keys.
80
63
program : CString ,
81
64
args : Vec < CString > ,
65
+ /// Exactly what will be passed to `execvp`.
66
+ ///
67
+ /// First element is a pointer to `program`, followed by pointers to
68
+ /// `args`, followed by a `null`. Be careful when modifying `program` or
69
+ /// `args` to properly update this as well.
82
70
argv : Argv ,
83
71
env : CommandEnv ,
84
72
0 commit comments