aboutsummaryrefslogtreecommitdiff
path: root/butl/process
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-04 13:38:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-04 13:38:27 +0200
commitf3f46a1656207a1c681e7c53cc3bd2c9a28fa887 (patch)
treee3f35ce96d8af5c7d0ec500abe502c3b681092e6 /butl/process
parentdecd319bc1bc7d427f92feba29d408eb2edb973d (diff)
Allow calling process::wait() multiple types, make process move-only
Diffstat (limited to 'butl/process')
-rw-r--r--butl/process11
1 files changed, 10 insertions, 1 deletions
diff --git a/butl/process b/butl/process
index c810b58..534ad88 100644
--- a/butl/process
+++ b/butl/process
@@ -67,23 +67,32 @@ namespace butl
// Wait for the process to terminate. Return true if the process
// terminated normally and with the zero exit status. Throw
- // process_error if anything goes wrong.
+ // process_error if anything goes wrong. This function can be
+ // called multiple times with subsequent calls simply returning
+ // the status.
//
bool
wait ();
~process () {if (id != 0) wait ();}
+ // Move constructible-only type.
+ //
+ process (process&&);
+ process& operator= (process&&) = delete;
+
process (const process&) = delete;
process& operator= (const process&) = delete;
#ifndef _WIN32
typedef pid_t id_type;
+ typedef int status_type;
#else
typedef void* id_type; // Win32 HANDLE.
#endif
id_type id;
+ status_type status;
int out_fd; // Write to this fd to send to the new process' stdin.
int in_ofd; // Read from this fd to receive from the new process' stdout.