1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

Shell: Allow control structures to appear in pipe sequences

This makes commands like the following to be possible:
```sh
$ ls && for $(seq 10) { echo $it }
$ ls | for $(seq 1) { cat > foobar }
```
This commit is contained in:
AnotherTest 2020-09-07 20:49:53 +04:30 committed by Andreas Kling
parent 7b5ead64a5
commit aa2df9277d
5 changed files with 73 additions and 41 deletions

View file

@ -196,6 +196,7 @@ struct Command {
bool should_wait { true };
bool is_pipe_source { false };
bool should_notify_if_in_background { true };
bool should_immediately_execute_next { false };
mutable RefPtr<Pipeline> pipeline;
Vector<NodeWithAction> next_chain;
@ -233,7 +234,7 @@ public:
}
CommandValue(Vector<String> argv)
: m_command({ move(argv), {}, true, false, true, nullptr, {} })
: m_command({ move(argv), {}, true, false, true, false, nullptr, {} })
{
}
@ -410,6 +411,8 @@ public:
virtual RefPtr<Node> leftmost_trivial_literal() const { return nullptr; }
Vector<Command> to_lazy_evaluated_commands(RefPtr<Shell> shell);
protected:
Position m_position;
bool m_is_syntax_error { false };