waitid() *may* be called many times if a job does not exit, so only
assert this fact when the job has in fact exited.
Also allows Background nodes to contain non-execute nodes.
This allows us to easily re-use history loading and saving in other
programs using Line::Editor, as well as implementing universally
recognized HISTCONTROL.
This adds support for (basic) brace expansions with the following
syntaxes:
- `{expr?,expr?,expr?,...}` which is directly equivalent to `(expr expr
expr ...)`, with the missing expressions replaced with an empty string
literal.
- `{expr..expr}` which is a new range expansion, with two modes:
- if both expressions are one unicode code point long, the range is
equivalent to the two code points and all code points between the
two (numerically).
- if both expressions are numeric, the range is equivalent to both
numbers, and all numbers between the two.
- otherwise, it is equivalent to `(expr expr)`.
Closes#3832.
In the future all (normal) output should be written by any of the
following functions:
out (currently called new_out)
outln
dbg (currently called new_dbg)
dbgln
warn (currently called new_warn)
warnln
However, there are still a ton of uses of the old out/warn/dbg in the
code base so the new functions are called new_out/new_warn/new_dbg. I am
going to rename them as soon as all the other usages are gone (this
might take a while.)
I also added raw_out/raw_dbg/raw_warn which don't do any escaping,
this should be useful if no formatting is required and if the input
contains tons of curly braces. (I am not entirely sure if this function
will stay, but I am adding it for now.)
Theoretically, this assertion should never trip (at least, on serenity
where we don't really reuse PIDs).
This change should be considered temporary, until we figure out whether
waitpid() is being called twice (and succeeding) for one given PID.
This really just works around the core issue, which is that we have no
reliable way to know exactly who raised the signal (yet).
Fixes#3645, in a very weird (yet apparently standard) way.
The following example should illustrate one issue arising from this:
$ echo 'exit 1' > example.sh
$ Shell example.sh
Good-bye!
This message is meant to be shown to an interactive user, but not in a
shell script.
This patchset makes it possible for the shell to format the current
buffer of the line editor live, with somewhat accurate cursor tracking.
Since this feature is pretty goofy at best, let's keep it off by default
for now :^)
Instead of everyone overriding save_to() and set_property() and doing
a pretty asymmetric job of implementing the various properties, let's
add a bit of structure here.
Object properties are now represented by a Core::Property. Properties
are registered with a getter and setter (optional) in constructors.
I've added some convenience macros for creating and registering
properties, but this does still feel a bit bulky. We'll have to
iterate on this and see where it goes.
This commit adds an equivalent to the sh 'case' construct, except it's
much more pleasing to look at and write:
```sh
match "$something" {
p1 { echo "p1!" }
p2 { echo "p2!" }
* { echo "string catch-all!" }
}
```
is the equivalent of:
```sh
case $something in
p1)
echo "p1!"
;;
p2)
echo "p2!"
;;
*)
echo "catch-all!"
;;
esac
```
Since our shell does not treat lists as strings, matching lists is also
possible:
```sh
match (1foo 2foo foo3) {
(?foo 2* *) { echo wowzers! }
(* * *) { echo 3-element list catch-all }
}
```
OutputMemoryStream was originally a proxy for DuplexMemoryStream that
did not expose any reading API.
Now I need to add another class that is like OutputMemoryStream but only
for static buffers. My first idea was to make OutputMemoryStream do that
too, but I think it's much better to have a distinct class for that.
I originally wanted to call that class FixedOutputMemoryStream but that
name is really cumbersome and it's a bit unintuitive because
InputMemoryStream is already reading from a fixed buffer.
So let's just use DuplexMemoryStream instead of OutputMemoryStream for
any dynamic stuff and create a new OutputMemoryStream for static
buffers.