From 27d3971ba6d5be40a45e1d8932f0a30d66035cb9 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 4 Aug 2020 14:23:06 +0200 Subject: [PATCH] QuickShow: Disown child process after spawning --- Applications/QuickShow/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp index 61d699d3b6a..13a3aa0f88d 100644 --- a/Applications/QuickShow/main.cpp +++ b/Applications/QuickShow/main.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -114,7 +115,12 @@ int main(int argc, char** argv) pid_t child; for (size_t i = 1; i < urls.size(); ++i) { const char* argv[] = { "/bin/QuickShow", urls[i].path().characters(), nullptr }; - posix_spawn(&child, "/bin/QuickShow", nullptr, nullptr, const_cast(argv), environ); + if ((errno = posix_spawn(&child, "/bin/QuickShow", nullptr, nullptr, const_cast(argv), environ))) { + perror("posix_spawn"); + } else { + if (disown(child) < 0) + perror("disown"); + } } } };