QuickShow: Disown child process after spawning

This commit is contained in:
Andreas Kling 2020-08-04 14:23:06 +02:00
parent 46ab006c58
commit 27d3971ba6
Notes: sideshowbarker 2024-07-19 04:19:19 +09:00

View file

@ -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");
}
}
}
};