LibreWeb-Browser/src/main.cc

29 lines
603 B
C++
Raw Normal View History

2020-11-14 14:13:00 -08:00
#include "mainwindow.h"
2020-12-06 16:15:31 -08:00
#include "ipfs.h"
2020-11-28 14:47:34 -08:00
#include <gtkmm/application.h>
2020-11-12 16:54:34 -08:00
int main(int argc, char *argv[])
{
2020-12-14 10:40:08 -08:00
pid_t child_pid = fork();
if (child_pid == 0)
{
// Run by child process
return IPFS::startIPFSDaemon();
}
else if (child_pid > 0 )
{
// Parent process (child_pid is PID of child)
auto app = Gtk::Application::create(argc, argv, "org.melroy.browser");
2020-12-06 16:15:31 -08:00
2020-12-14 10:40:08 -08:00
MainWindow window;
int exitCode = app->run(window);
// Kill also the child
kill(child_pid, SIGTERM);
return exitCode;
}
else // PID < 0, error
{
printf("ERROR: fork failed.\n");
}
2020-11-12 16:54:34 -08:00
}