Skip to content

LibShell: Stop reading error source text directly from the source file - #27141

Open
educasadei wants to merge 2 commits into
SerenityOS:masterfrom
educasadei:shell-keep-source
Open

educasadei wants to merge 2 commits into
SerenityOS:masterfrom
educasadei:shell-keep-source

Conversation

@educasadei

Copy link
Copy Markdown
Contributor

The source file could be taken from a relative path which caused problems when the Shell tried to print error messages for scripts that changed the working directory, because that path had become invalid.

The function for running a script file already reads it's source data
into a buffer, so also set the source text to it.
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.
@github-actions github-actions Bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Oct 30, 2026

@LucasChollet LucasChollet left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems perfectly reasonable to me! (I will try to get @alimpfard to take a look too, in case re-reading the file was intentional)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👀 pr-needs-review PR needs review from a maintainer or community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants