diff options
-rw-r--r-- | build2/test/script/parser.cxx | 20 | ||||
-rw-r--r-- | build2/test/script/script | 2 |
2 files changed, 10 insertions, 12 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 diff --git a/build2/test/script/script b/build2/test/script/script index f0d8f21..a21f0c6 100644 --- a/build2/test/script/script +++ b/build2/test/script/script @@ -68,7 +68,7 @@ namespace build2 union { - int fd; // Used with 'merge' type. + int fd; // Merge-to descriptor. string str; // Note: includes trailing newline, if required. doc_type doc; file_type file; |