AnotherTest
2b867ff555
Shell: Complete named function parameters inside the function body
2020-09-14 17:40:18 +02:00
AnotherTest
b7661dee46
Shell: Add some tests for functions
2020-09-14 17:40:18 +02:00
AnotherTest
d1550ea64f
Shell: Add support for functions
...
This implementation does not have support for 'return' yet.
2020-09-14 17:40:18 +02:00
AnotherTest
519aa2048a
Shell: Use a subshell instead of explicitly calling a shell binary in a test
...
This commit fixes a FIXME in a test, as we have subshells now.
2020-09-14 17:40:18 +02:00
AnotherTest
0b57cdff82
Shell: Add support for $0,$1,...
2020-09-14 17:40:18 +02:00
AnotherTest
063fb02ef4
Shell: Move the first command in a pipeline to the pipeline pgid too
...
This process is supposed to be the session leader of the pipeline
process group, we can't *not* move it into that group :P
2020-09-12 21:18:24 +02:00
AnotherTest
927e2fc6bc
Shell: Do not reset the terminal attributes when command is run in bg
...
Also removes a FIXME that no longer applies.
2020-09-10 11:20:22 +02:00
AnotherTest
2488815bdb
Shell: Add some tests for subshells
2020-09-09 20:35:21 +02:00
AnotherTest
b194d79c53
Shell: Add the (now) free subshell support
2020-09-09 20:35:21 +02:00
AnotherTest
0fd8d5ad3d
Shell: Add a test for control structures as commands
2020-09-09 20:35:21 +02:00
AnotherTest
54b453be57
Shell: Fix event loop processing and backgrounding in subshells
2020-09-09 20:35:21 +02:00
AnotherTest
aa2df9277d
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 }
```
2020-09-09 20:35:21 +02:00
AnotherTest
7b5ead64a5
Shell: Announce job events at the right times
...
This fixes a duplicate message when running `jobs` for the first time
after a job has been moved to the background.
Also actually announces background exits now :^)
2020-09-09 20:35:21 +02:00
AnotherTest
715e11f692
Shell: Fix job control and backgrounding
...
This patchset makes the shell capable of lazily resolving and executing
sequences of commands, to allow for putting logical sequences in the
background.
In particular, it enables And/Or/Sequence nodes to be run in the background,
and consequently unmarks them as `would_execute`.
Doing so also fixes job control to an extent, as jobs are now capable of
having 'tails', so sequences can be put in the background while
preserving their following sequences.
2020-09-09 20:35:21 +02:00
asynts
b68a873067
AK: Move memory streams into their own header.
2020-09-01 17:25:26 +02:00
Nico Weber
8b166e57df
Misc: Remove some unneeded includes of Timer.h and ElapsedTimer.h ( #3286 )
2020-08-25 09:41:56 +02:00
AnotherTest
db18e75a09
Shell: Add tests for 'if'
2020-08-22 20:53:21 +02:00
AnotherTest
b90eb5c9ba
Shell: Add 'if' expressions
...
```sh
if foo bar baz {
quux
} else if foobar || whatever {
echo I ran out of example words
} else {
exit 2
}
```
2020-08-22 20:53:21 +02:00
AnotherTest
103f659ef6
Shell: Actually process for loop entries as a stream
...
This actually does what d4bcc68
meant to do.
2020-08-22 20:52:07 +02:00
AnotherTest
2c14abedd6
Shell: Do not flatten syntactic lists in for_each_entry()
2020-08-22 20:52:07 +02:00
AnotherTest
0676bd4afc
Shell: Mark AST::Background as would_execute if its subnode does
2020-08-22 20:52:07 +02:00
AnotherTest
30554c969c
LibLine: Handle interrupts/window size changes internally
2020-08-21 16:10:51 +02:00
AnotherTest
238e87de4e
LibLine: Handle Ctrl-C and Ctrl-D in a way similar to other line editors
...
Makes C-c print "^C" and continue prompting on a new line.
Also fixes a problem where an interrupted get_line() would need more
read()'s than required to update the display.
2020-08-21 16:10:51 +02:00
AnotherTest
d4bcc689fb
Shell: Make 'for' loops read their input as an stream
...
i.e. process an element as it becomes available.
2020-08-21 16:00:42 +02:00
AnotherTest
cf18bff72a
Shell: Do not attempt to yank the TTY from background processes
...
They don't own the TTY anyway!
2020-08-19 21:21:34 +02:00
AnotherTest
217eca3d3f
Shell: Name the pipe ends correctly
2020-08-19 21:21:34 +02:00
AnotherTest
20d4287eaf
Shell: Fix outdated debug log code
2020-08-19 21:21:34 +02:00
AnotherTest
4ee4c94d60
Shell: Respect the 'PROMPT_EOL_MARK' environment variable
...
This allows the users to customise what is shown when a command ends
without a newline.
2020-08-18 16:58:17 +02:00
AnotherTest
d0aab41628
LibLine: Read configuration from a config file
2020-08-18 12:07:32 +02:00
AnotherTest
14a54a72fa
Shell: Ensure that the cursor starts on a new line
...
And print an indicator when it doesn't, a la zsh.
2020-08-17 17:44:02 +02:00
AnotherTest
154ffa3f5f
Shell: Add some tests for builtin redirection
2020-08-15 20:48:17 +02:00
AnotherTest
c589625418
Shell: Allow redirections and pipes on builtins
...
Fixes #3072 .
2020-08-15 20:48:17 +02:00
AnotherTest
d9a1cb440c
Shell: Restore input offset when failing to parse a redirection
...
This fixes #3051
2020-08-14 14:51:31 +02:00
AnotherTest
0950fd1438
Shell: Start writing a man page
...
This patch adds two man pages describing the parts of the shell that
have been so far finalised.
2020-08-14 10:31:52 +02:00
Nico Weber
924951e426
Shell: Add test for 37d5e3e0df
/ #3073
2020-08-13 18:45:39 +02:00
Andreas Kling
85b02d887b
Shell: Add create() factory function for PathRedirection
2020-08-12 12:15:30 +02:00
Andreas Kling
e8d665337a
Shell: Fix another FdRedirection reference leak
...
Add a create() factory function to prevent this from happening again.
2020-08-12 12:13:33 +02:00
AnotherTest
2b51250863
Shell: Wait for the parent to deal with the PGID stuff before execvp()
2020-08-12 11:41:18 +02:00
AnotherTest
be395aab9a
Shell: Do not assume that the job has exited after unblock in fg
2020-08-12 11:41:18 +02:00
AnotherTest
7aa5a2bc0f
Shell: Eliminate possible use-after-free in builtin_fg()
...
This fixes a possible UAF where the job might be destroyed in
block_on_job().
2020-08-12 11:41:18 +02:00
AnotherTest
1dc5574245
Shell: Eliminate reference leak in AST::Execute::run()
2020-08-12 11:41:18 +02:00
AnotherTest
ab3e787334
Shell: Moves pipelined processes to one process group
2020-08-12 11:41:18 +02:00
AnotherTest
8a17527bc5
Shell: Show the job id instead of the pid when a job exits in background
2020-08-12 11:41:18 +02:00
Nico Weber
37d5e3e0df
Shell: Fix fd leak with pipes
...
Fixes the problem reported in #3073 . While trying to write a test
for this, I thought I'd use
Shell -c 'for i in $(seq 100) { echo $i }' | head -n 1
but that makes the cpu spin at 100% and doesn't terminate even
with this fix here. But at least piping disasm into head now works.
2020-08-10 20:57:38 +02:00
AnotherTest
69fc91d974
Shell: Cancel a running for loop upon receiving any non-SIGINT signal
...
And keep the old behaviour of needing two interruptions on SIGINT.
2020-08-10 20:50:06 +02:00
AnotherTest
9fde92db38
Shell: Make redirections without commands apply to all future commands
...
This restirects redirection-only commands' scope, and keeps their
usefulness too!
2020-08-09 21:50:33 +02:00
AnotherTest
5ae2f6e9ec
Shell: Stop a for loop upon receiving two consecutive interruptions
...
This does not work perfectly (just like every other shell...), if the
running program handles the signal (SIGINT in this case) and quits
cleanly, the shell cannot detect the interruption.
This is the case with our `sleep(1)`.
2020-08-09 21:08:07 +02:00
Andreas Kling
3b3d158649
Shell: Make Command::redirections a NonnullRefPtrVector
2020-08-07 09:42:12 +02:00
Andreas Kling
c29681cb03
Shell: Make VariableDeclarations::Variable store NonnullRefPtrs
2020-08-07 09:41:04 +02:00
Andreas Kling
e9c602bc83
Shell: Make resolve_without_cast() return NonnullRefPtr<Value>
2020-08-07 09:36:15 +02:00