mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 19:19:44 +03:00
Shell: Set up the PWD environment variable early
This ensures that PWD is set when running "sh -c something"
This commit is contained in:
parent
d7cfe61fe4
commit
4a271430f8
Notes:
sideshowbarker
2024-07-19 08:51:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4a271430f87
@ -981,6 +981,13 @@ int main(int argc, char** argv)
|
||||
if (rc < 0)
|
||||
perror("ttyname_r");
|
||||
|
||||
{
|
||||
auto* cwd = getcwd(nullptr, 0);
|
||||
g.cwd = cwd;
|
||||
setenv("PWD", cwd, 1);
|
||||
free(cwd);
|
||||
}
|
||||
|
||||
{
|
||||
auto* pw = getpwuid(getuid());
|
||||
if (pw) {
|
||||
@ -1012,13 +1019,6 @@ int main(int argc, char** argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
{
|
||||
auto* cwd = getcwd(nullptr, 0);
|
||||
g.cwd = cwd;
|
||||
setenv("PWD", cwd, 1);
|
||||
free(cwd);
|
||||
}
|
||||
|
||||
g.directory_stack.append(g.cwd);
|
||||
|
||||
load_history();
|
||||
|
Loading…
Reference in New Issue
Block a user