diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-10-25 00:33:04 +0300 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 09:26:35 +0200 |
commit | 6939574c5a2d1859666296b4a7ab3f5a0e8db299 (patch) | |
tree | 76273c18aa59f302b43c5d63d45401a492520468 | |
parent | 56ce654f7e4608599369b303ed39eaddb0f77eee (diff) |
Add support for <+ and >+ redirects
-rw-r--r-- | build2/test/script/runner.cxx | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx index 55c3ffe..8f57ad0 100644 --- a/build2/test/script/runner.cxx +++ b/build2/test/script/runner.cxx @@ -228,10 +228,18 @@ namespace build2 // process to hang which can be interpreted as a test failure. // @@ Both ways are quite ugly. Is there some better way to do this? // - int in (c.in.type == redirect_type::null || - c.in.type == redirect_type::none - ? -2 - : -1); + int in; + + switch (c.in.type) + { + case redirect_type::pass: in = 0; break; + + case redirect_type::here_string: + case redirect_type::here_document: in = -1; break; + + case redirect_type::null: + case redirect_type::none: in = -2; break; + } // Dealing with stdout and stderr redirect types other than 'null' // using pipes is tricky in the general case. Going this path we @@ -277,16 +285,20 @@ namespace build2 ofdstream so; path stdout (opath ("stdout")); - int out (c.out.type == redirect_type::null - ? -2 - : open (so, stdout)); + int out (c.out.type == redirect_type::pass + ? 1 + : c.out.type == redirect_type::null + ? -2 + : open (so, stdout)); ofdstream se; path stderr (opath ("stderr")); - int err (c.err.type == redirect_type::null - ? -2 - : open (se, stderr)); + int err (c.err.type == redirect_type::pass + ? 2 + : c.err.type == redirect_type::null + ? -2 + : open (se, stderr)); if (verb >= 2) print_process (args); |