aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/parser.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-10-27 10:04:10 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-11-04 09:26:36 +0200
commit33c5d3e0fce306631bad78ba3a4a87bb1f719fa5 (patch)
treeadd88005988d9c023d7e1f0ea7ffcc25e16681f2 /build2/test/script/parser.cxx
parent023d8d8b040d5fce821080b016b4ce25eb67550d (diff)
Minor changes to merge redirect code
Diffstat (limited to 'build2/test/script/parser.cxx')
-rw-r--r--build2/test/script/parser.cxx20
1 files changed, 9 insertions, 11 deletions
diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx
index 70f1ef2..2d9a065 100644
--- a/build2/test/script/parser.cxx
+++ b/build2/test/script/parser.cxx
@@ -599,17 +599,16 @@ namespace build2
try
{
size_t n;
- if (stoi (w, &n) != fd || n != w.size ())
- throw invalid_argument (string ());
- }
- catch (const exception&)
- {
- fail (l) << "invalid " << (fd == 1 ? "stderr" : "stdout")
- << " merge redirect file descriptor '" << w << "'" <<
- info << "must be " << fd;
+ if (stoi (w, &n) == fd || n == w.size ())
+ {
+ r.fd = fd;
+ return;
+ }
}
+ catch (const exception&) {} // Fall through.
- r.fd = fd;
+ fail (l) << (fd == 1 ? "stderr" : "stdout") << " merge redirect "
+ << "file descriptor must be " << fd;
};
auto add_here_str = [&nn] (redirect& r, string&& w)
@@ -1139,8 +1138,7 @@ namespace build2
if (c.out.type == redirect_type::merge &&
c.err.type == redirect_type::merge)
- fail (l) << "stdout and stderr merge redirects" <<
- info << "should not be specified at the same time";
+ fail (l) << "stdout and stderr redirected to each other";
}
// While we no longer need to recognize command line operators, we