diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-04-12 17:09:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-04-12 17:09:35 +0200 |
commit | ce4848cfaaa569da3e11de51f4174eb21709b9b9 (patch) | |
tree | dd9918fd6b769591912c4e6dbbb05ac73364035b /libbuild2/script/parser.cxx | |
parent | 33be784e4b991a95d3ef14a6ef555f1299ec7021 (diff) |
Add -s|--timeout-success option to env script builtin
The semantics is equivalent to the --success option we already have in the
timeout builtin.
Diffstat (limited to 'libbuild2/script/parser.cxx')
-rw-r--r-- | libbuild2/script/parser.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libbuild2/script/parser.cxx b/libbuild2/script/parser.cxx index ae6da76..84d2afc 100644 --- a/libbuild2/script/parser.cxx +++ b/libbuild2/script/parser.cxx @@ -1134,9 +1134,10 @@ namespace build2 if (t.value == "env") { parsed_env r (parse_env_builtin (t, tt)); - c.cwd = move (r.cwd); - c.variables = move (r.variables); - c.timeout = r.timeout; + c.cwd = move (r.cwd); + c.variables = move (r.variables); + c.timeout = r.timeout; + c.timeout_success = r.timeout_success; env = true; } else if (t.value == "for") @@ -1601,6 +1602,10 @@ namespace build2 { r.timeout = chrono::seconds (*v); } + else if (o == "-s" || o == "--timeout-success") + { + r.timeout_success = true; + } else if (optional<dir_path> v = dir ("--cwd", "-c")) { r.cwd = move (*v); @@ -1615,6 +1620,9 @@ namespace build2 break; } + if (r.timeout_success && !r.timeout) + fail (l) << "env: -s|--timeout-success specified without -t|--timeout"; + // Parse arguments (variable sets). // for (; i != e; ++i) |