1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00

Kernel: Simplify execve shebang argument handling

This commit is contained in:
Jelle Raaijmakers 2021-06-06 01:13:25 +02:00 committed by Andreas Kling
parent 250f8eccf3
commit d6a3f1fcd7
Notes: sideshowbarker 2024-07-18 12:39:12 +09:00

View file

@ -846,14 +846,11 @@ KResult Process::exec(String path, Vector<String> arguments, Vector<String> envi
// 1) #! interpreted file
auto shebang_result = find_shebang_interpreter_for_executable(first_page, nread_or_error.value());
if (!shebang_result.is_error()) {
Vector<String> new_arguments(shebang_result.value());
new_arguments.append(path);
arguments.remove(0);
new_arguments.append(move(arguments));
return exec(shebang_result.value().first(), move(new_arguments), move(environment), ++recursion_depth);
auto shebang_words = shebang_result.release_value();
auto shebang_path = shebang_words.first();
if (!arguments.try_prepend(move(shebang_words)))
return ENOMEM;
return exec(shebang_path, move(arguments), move(environment), ++recursion_depth);
}
// #2) ELF32 for i386