aboutsummaryrefslogtreecommitdiff
path: root/butl/process.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-10 13:19:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-10 13:19:19 +0200
commit550b5257aba507bcce98f6832b8905769a14955d (patch)
tree82804b1d214e94ceb8736f215dd20082614cbc1c /butl/process.cxx
parent0703f7a1acc9bf9512fdcad43a18a17981c8ca9e (diff)
Add process_run()/process_start() higher-level API on top of class process
Diffstat (limited to 'butl/process.cxx')
-rw-r--r--butl/process.cxx22
1 files changed, 13 insertions, 9 deletions
diff --git a/butl/process.cxx b/butl/process.cxx
index 189d1ee..74892e6 100644
--- a/butl/process.cxx
+++ b/butl/process.cxx
@@ -64,7 +64,7 @@ namespace butl
process_path r (try_path_search (f, init, fb));
if (r.empty ())
- throw process_error (ENOENT, false);
+ throw process_error (ENOENT);
return r;
}
@@ -259,7 +259,13 @@ namespace butl
fdpipe in_ofd;
fdpipe in_efd;
- auto fail = [] (bool child) {throw process_error (errno, child);};
+ auto fail = [] (bool child)
+ {
+ if (child)
+ throw process_child_error (errno);
+ else
+ throw process_error (errno);
+ };
auto open_pipe = [] () -> fdpipe
{
@@ -276,7 +282,7 @@ namespace butl
// other hand the only possible values are EMFILE and ENFILE. Lets use
// EMFILE as the more probable. This is a temporary code after all.
//
- throw process_error (EMFILE, false);
+ throw process_error (EMFILE);
}
};
@@ -391,7 +397,7 @@ namespace butl
// information available" semantics.
//
if (!ie)
- throw process_error (errno, false);
+ throw process_error (errno);
}
else
exit = process_exit (es, process_exit::as_status);
@@ -401,7 +407,7 @@ namespace butl
}
bool process::
- try_wait (bool& s)
+ try_wait ()
{
if (handle != 0)
{
@@ -414,12 +420,11 @@ namespace butl
handle = 0; // We have tried.
if (r == -1)
- throw process_error (errno, false);
+ throw process_error (errno);
exit = process_exit (es, process_exit::as_status);
}
- s = exit && exit->normal () && exit->code () == 0;
return true;
}
@@ -1089,7 +1094,7 @@ namespace butl
}
bool process::
- try_wait (bool& s)
+ try_wait ()
{
if (handle != 0)
{
@@ -1112,7 +1117,6 @@ namespace butl
exit->status = es;
}
- s = exit && exit->normal () && exit->code () == 0;
return true;
}