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
Andreas Kling
420e809fee
Shell: Store ListValue's values in a NonnullRefPtrVector<Value>
...
A ListValue never stores null Values, so it makes sense to restrict it.
This also propagates use of NonnullRefPtr to the create() helpers.
There's a small bit of awkwardness around the use of initializer_list,
since we cannot directly construct a NonnullRefPtrVector from one.
2020-08-07 09:33:05 +02:00
Andreas Kling
08e5371f44
Shell: Add some obvious move() calls in AST constructors
2020-08-07 09:19:59 +02:00
Nico Weber
3cc9e8ba41
LibLine+Shell: Remove unused split_mechanism
...
It was only read in should_break_token(), which had no callers.
should_break_token() also got `foo\\ bar` and `"foo bar"` wrong.
2020-08-06 20:37:39 +02:00
Andreas Kling
8dd0c391e9
Shell: Make "fg" set the TTY PGID before SIGCONT'ing the job
...
Otherwise the child will get SIGTTIN/SIGTTOU on next TTY I/O.
2020-08-06 15:50:57 +02:00
Andreas Kling
0c6ce063e6
Shell: Print job status after suspending a command
2020-08-06 15:33:04 +02:00
Andreas Kling
22dd5a7021
Shell: Move printing job status into a Job::print_status() helper
...
This is only used by the "jobs" builtin right now, but more soon.
2020-08-06 15:09:49 +02:00
Andreas Kling
d9aecc8e08
Shell: Remove unnecessary ignore() in Shell::custom_event()
...
Ignoring an event means that it will bubble to the parent Core::Object.
This is not necessary here.
2020-08-06 14:27:06 +02:00
Andreas Kling
b8440b12b7
Shell: Store jobs as NonnullRefPtr<Job>
2020-08-06 14:09:13 +02:00
Andreas Kling
5bce0193de
Shell: Make Job constructors private and use a create() helper
...
Also store PGIDs as pid_t since that's what they are.
2020-08-06 13:48:45 +02:00
Andreas Kling
bf2cd9374c
Shell: Make run_command() return a NonnullRefPtrVector<Job>
...
This never returns null Job pointers.
2020-08-06 13:44:30 +02:00
AnotherTest
ff01cfa08a
Shell: Mark suspended children as such when receiving a SIGCHLD
2020-08-06 10:35:22 +02:00
AnotherTest
7b15c85ff5
Shell: Do not assume that stdin/stdout is a TTY
...
This closes #2989 .
2020-08-05 17:30:31 +02:00
AnotherTest
771751258e
Shell: Give the TTY to the foreground process
...
This fixes the bug with the shell not waiting for any foreground process
that attempts to read from the terminal in the Lagom build.
2020-08-04 21:22:44 +02:00
Andreas Kling
3cb8ae873c
Shell: Use NonnullRefPtr to simplify some things in the parser/AST
2020-08-04 18:17:16 +02:00