mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +00:00
FileManager: Use Core::System::exec()
This commit is contained in:
parent
d2b32924d6
commit
88800e8f32
Notes:
sideshowbarker
2024-07-17 12:05:45 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/88800e8f32 Pull-request: https://github.com/SerenityOS/serenity/pull/13013 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/bgianfo
1 changed files with 4 additions and 9 deletions
|
@ -50,7 +50,7 @@ ErrorOr<void> run_file_operation(FileOperation operation, Vector<String> const&
|
|||
TRY(Core::System::close(pipe_fds[0]));
|
||||
TRY(Core::System::dup2(pipe_fds[1], STDOUT_FILENO));
|
||||
|
||||
Vector<char const*> file_operation_args;
|
||||
Vector<StringView> file_operation_args;
|
||||
file_operation_args.append("/bin/FileOperation");
|
||||
|
||||
switch (operation) {
|
||||
|
@ -68,17 +68,12 @@ ErrorOr<void> run_file_operation(FileOperation operation, Vector<String> const&
|
|||
}
|
||||
|
||||
for (auto& source : sources)
|
||||
file_operation_args.append(source.characters());
|
||||
file_operation_args.append(source.view());
|
||||
|
||||
if (operation != FileOperation::Delete)
|
||||
file_operation_args.append(destination.characters());
|
||||
file_operation_args.append(destination.view());
|
||||
|
||||
file_operation_args.append(nullptr);
|
||||
|
||||
if (execvp(file_operation_args.first(), const_cast<char**>(file_operation_args.data())) < 0) {
|
||||
perror("execvp");
|
||||
_exit(1);
|
||||
}
|
||||
TRY(Core::System::exec(file_operation_args.first(), file_operation_args, Core::System::SearchInPath::Yes));
|
||||
VERIFY_NOT_REACHED();
|
||||
} else {
|
||||
TRY(Core::System::close(pipe_fds[1]));
|
||||
|
|
Loading…
Reference in a new issue