FileManager: Use Core::System::exec()

This commit is contained in:
Sam Atkins 2022-04-02 13:45:33 +01:00 committed by Andreas Kling
parent d2b32924d6
commit 88800e8f32
Notes: sideshowbarker 2024-07-17 12:05:45 +09:00

View file

@ -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]));