aboutsummaryrefslogtreecommitdiff
path: root/tests/process/driver.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-12 17:24:00 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-23 19:42:48 +0300
commit6c8e3f09c185d7fa4664ccd9e5c4f623a17b84cc (patch)
tree513f523dba31f275994d8152c02db82f3380c56e /tests/process/driver.cxx
parent09bedede7116961fbfb298a6a6cfa933af7af682 (diff)
Extend fdstream
Diffstat (limited to 'tests/process/driver.cxx')
-rw-r--r--tests/process/driver.cxx26
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/process/driver.cxx b/tests/process/driver.cxx
index 741340c..5c43fb5 100644
--- a/tests/process/driver.cxx
+++ b/tests/process/driver.cxx
@@ -68,13 +68,12 @@ exec (const path& p,
auto bin_mode = [bin](int fd) -> int
{
if (bin)
- fdmode (fd, fdtranslate::binary);
+ fdmode (fd, fdstream_mode::binary);
return fd;
};
ofdstream os (bin_mode (pr.out_fd));
- os.exceptions (ofdstream::badbit);
copy (in.begin (), in.end (), ostream_iterator<char> (os));
os.close ();
@@ -166,7 +165,6 @@ exec (const path& p,
int
main (int argc, const char* argv[])
-try
{
bool child (false);
bool bin (false);
@@ -201,8 +199,7 @@ try
if (i != argc)
{
if (!child)
- cerr << "usage: " << argv[0] << " [-c] [-i] [-o] [-e] [-b] [<dir>]"
- << endl;
+ cerr << "usage: " << argv[0] << " [-c] [-b] [<dir>]" << endl;
return 1;
}
@@ -235,9 +232,9 @@ try
{
if (bin)
{
- stdin_fdmode (fdtranslate::binary);
- stdout_fdmode (fdtranslate::binary);
- stderr_fdmode (fdtranslate::binary);
+ stdin_fdmode (fdstream_mode::binary);
+ stdout_fdmode (fdstream_mode::binary);
+ stderr_fdmode (fdstream_mode::binary);
}
vector<char> data
@@ -317,8 +314,13 @@ try
//
assert (exec (
fp.leaf (), vector<char> (), false, false, false, true, fp.directory ()));
-}
-catch (const system_error&)
-{
- assert (false);
+
+#ifndef _WIN32
+ // Check that wait() works properly if the underlying low-level wait
+ // operation fails.
+ //
+ process pr;
+ pr.handle = reinterpret_cast<process::handle_type>(-1);
+ assert (!pr.wait (true) && !pr.wait (false));
+#endif
}