text
stringlengths 0
2.2M
|
---|
DEFINE_bool(child, false, "");
|
namespace {
|
constexpr int kSignal = SIGUSR1;
|
} // namespace
|
void runChild(const char* file) {
|
// Block SIGUSR1 so it's queued
|
sigset_t sigs;
|
CHECK_ERR(sigemptyset(&sigs));
|
CHECK_ERR(sigaddset(&sigs, kSignal));
|
CHECK_ERR(sigprocmask(SIG_BLOCK, &sigs, nullptr));
|
// Kill the parent, wait for our signal.
|
CHECK_ERR(kill(getppid(), SIGKILL));
|
int sig = 0;
|
CHECK_ERR(sigwait(&sigs, &sig));
|
CHECK_EQ(sig, kSignal);
|
// Signal completion by creating the file
|
CHECK_ERR(creat(file, 0600));
|
}
|
[[noreturn]] void runParent(const char* file) {
|
std::vector<std::string> args{"/proc/self/exe", "--child", file};
|
Subprocess proc(args, Subprocess::Options().parentDeathSignal(kSignal));
|
CHECK(proc.poll().running());
|
// The child will kill us.
|
for (;;) {
|
pause();
|
}
|
}
|
int main(int argc, char* argv[]) {
|
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
CHECK_EQ(argc, 2);
|
if (FLAGS_child) {
|
runChild(argv[1]);
|
} else {
|
runParent(argv[1]);
|
}
|
return 0;
|
}
|
/*
|
==============================================================================
|
This file is part of the JUCE library.
|
Copyright (c) 2020 - Raw Material Software Limited
|
JUCE is an open source library subject to commercial or open-source
|
licensing.
|
By using JUCE, you agree to the terms of both the JUCE 6 End-User License
|
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
|
End User License Agreement: www.juce.com/juce-6-licence
|
Privacy Policy: www.juce.com/juce-privacy-policy
|
Or: You may also use this code under the terms of the GPL v3 (see
|
www.gnu.org/licenses).
|
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
|
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
|
DISCLAIMED.
|
==============================================================================
|
*/
|
namespace juce
|
{
|
Image JUCE_API getIconFromApplication (const String&, int) { return {}; }
|
}
|
/*
|
==============================================================================
|
This file is part of the JUCE library.
|
Copyright (c) 2020 - Raw Material Software Limited
|
JUCE is an open source library subject to commercial or open-source
|
licensing.
|
By using JUCE, you agree to the terms of both the JUCE 6 End-User License
|
Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
|
End User License Agreement: www.juce.com/juce-6-licence
|
Privacy Policy: www.juce.com/juce-privacy-policy
|
Or: You may also use this code under the terms of the GPL v3 (see
|
www.gnu.org/licenses).
|
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
|
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
|
DISCLAIMED.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.