mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibCore: Ensure exec()
keeps a reference to the executable path
When called with `SearchInPath::Yes`, calls to `Core::System::exec()` would fail. The value returned from `resolve_executable_from_environment()` was assigned to a StringView, but the original reference was not kept, causing the StringView to appear empty.
This commit is contained in:
parent
0177e4e6ba
commit
cbe5aeb917
Notes:
sideshowbarker
2024-07-17 03:03:44 +09:00
Author: https://github.com/tcl3
Commit: cbe5aeb917
Pull-request: https://github.com/SerenityOS/serenity/pull/19307
Reviewed-by: https://github.com/gmta ✅
1 changed files with 3 additions and 2 deletions
|
@ -1263,14 +1263,15 @@ ErrorOr<void> exec(StringView filename, ReadonlySpan<StringView> arguments, Sear
|
||||||
};
|
};
|
||||||
|
|
||||||
StringView exec_filename;
|
StringView exec_filename;
|
||||||
|
String resolved_executable_path;
|
||||||
if (search_in_path == SearchInPath::Yes) {
|
if (search_in_path == SearchInPath::Yes) {
|
||||||
auto executable_or_error = resolve_executable_from_environment(filename);
|
auto executable_or_error = resolve_executable_from_environment(filename);
|
||||||
|
|
||||||
if (executable_or_error.is_error())
|
if (executable_or_error.is_error())
|
||||||
return executable_or_error.release_error();
|
return executable_or_error.release_error();
|
||||||
|
|
||||||
exec_filename = executable_or_error.value();
|
resolved_executable_path = executable_or_error.release_value();
|
||||||
|
exec_filename = resolved_executable_path;
|
||||||
} else {
|
} else {
|
||||||
exec_filename = filename;
|
exec_filename = filename;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue