Use the saved source text instead of trying to read it directly from the
source file, as the source file may be a relative path and the script
could have changed the current working directory which would make the
path invalid.
The correct POSIX behaviour when changing directory is to resolve the
path logically, not following symlinks. Optionally having the -P flag to
resolve the path physically, which follows symlinks.
1c7233f148 broke this by moving the
initialization later, while still having the shell use the invalid
termios data.
Also, this commit makes it so *only* the init script is run without the
termios populated, as 'Shell -c ...' should still behave like running
the command in the shell.
Note that the two `.span()` added in LibShell just make the copy
explicit. These two calls to `extend` ended up relying on this copy
constructor: `Vector(Vector<T, other_inline_capacity> const& other)`, so
it was never a real move.
This API will always succeed in creating a String representing the
provided number in base-10.
(cherry picked from commit dd419b5a8df3b9a32478c4a8f0ea9f70334214cd;
amended to update the rest of the system. No conflicts though!)
This fixes a rendering issue where the first line of the prompt
overwrites a line with "% ...", which leaves the "%" in the terminal
if the prompt starts with "\n".
To be able to do this, we actually change multiple things:
- We create another subset library from LibCore called LibCoreBasic.
- We force LibLine and LibShellMinimal to use LibCoreMinimal and
LibCoreBasic and only these, instead of the full version (LibCore).
As a preparation for the next commit, we now have a reduced version of
LibShell which can be used with BuggieBox. That version will not include
LibSyntax, LibURL or LibCodeComprehension, which are all quite heavy for
BuggieBox to include in its own binary.
This change ensures that users can use LibShell easily understand this
library now, because we have an actual library directory.
In addition to that, we move the test scripts to Tests/LibShell, to
match the usual pattern of putting test-related files in the Tests/
directory.