aboutsummaryrefslogtreecommitdiff
path: root/butl/process
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-06-03 14:20:50 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-06-03 21:18:22 +0300
commit265c3c71a82906de252637ecbdacf23a99b2ea0c (patch)
treeed54306dedb101208a0fea220ec230d9f0e1c2da /butl/process
parent08c7238ae6be49d6eb51099107538f5a4522f9dd (diff)
Add fdnull()
Diffstat (limited to 'butl/process')
-rw-r--r--butl/process15
1 files changed, 10 insertions, 5 deletions
diff --git a/butl/process b/butl/process
index 0f68943..54a8dae 100644
--- a/butl/process
+++ b/butl/process
@@ -38,11 +38,16 @@ namespace butl
{
public:
// Start another process using the specified command line. The default
- // values to the in, out and err arguments indicate that the child
- // process should inherit the parent process stdin, stdout, and stderr,
+ // values to the in, out and err arguments indicate that the child process
+ // should inherit the parent process stdin, stdout, and stderr,
// respectively. If -1 is passed instead, then the corresponding child
// process descriptor is connected (via a pipe) to out_fd for stdin,
- // in_ofd for stdout, and in_efd for stderr (see data members below).
+ // in_ofd for stdout, and in_efd for stderr (see data members below). If
+ // -2 is passed, then the corresponding child process descriptor is
+ // replaced with the null device descriptor (e.g., /dev/null). This
+ // results in the child process not being able to read anything from stdin
+ // (gets immediate EOF) and all data written to stdout/stderr being
+ // discarded.
//
// On Windows parent process pipe descriptors are set to text mode to be
// consistent with the default (text) mode of standard file descriptors of
@@ -52,8 +57,8 @@ namespace butl
// translated into the 0xD, 0xA sequence. Use the _setmode() function to
// change the mode, if required.
//
- // Instead of passing -1 or the default value, you can also pass your own
- // descriptors. Note, however, that in this case they are not closed by
+ // Instead of passing -1, -2 or the default value, you can also pass your
+ // own descriptors. Note, however, that in this case they are not closed by
// the parent. So you should do this yourself, if required. For example,
// to redirect the child process stdout to stderr, you can do:
//