diff options
author | Andreas Kling <kling@serenityos.org> | 2020-08-04 14:23:06 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-04 18:17:16 +0200 |
commit | 27d3971ba6d5be40a45e1d8932f0a30d66035cb9 (patch) | |
tree | 5157aceb9b875a93b610ef347db4d727f4e3320d /Applications | |
parent | 46ab006c58041209f6fc6a4e8903bf0b3547b6d4 (diff) | |
download | serenity-27d3971ba6d5be40a45e1d8932f0a30d66035cb9.zip |
QuickShow: Disown child process after spawning
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/QuickShow/main.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Applications/QuickShow/main.cpp b/Applications/QuickShow/main.cpp index 61d699d3b6..13a3aa0f88 100644 --- a/Applications/QuickShow/main.cpp +++ b/Applications/QuickShow/main.cpp @@ -44,6 +44,7 @@ #include <LibGfx/Bitmap.h> #include <LibGfx/Palette.h> #include <LibGfx/Rect.h> +#include <serenity.h> #include <spawn.h> #include <stdio.h> #include <string.h> @@ -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<char**>(argv), environ); + if ((errno = posix_spawn(&child, "/bin/QuickShow", nullptr, nullptr, const_cast<char**>(argv), environ))) { + perror("posix_spawn"); + } else { + if (disown(child) < 0) + perror("disown"); + } } } }; |