forked from krypdkat/qubicbob
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (32 loc) · 712 Bytes
/
main.cpp
File metadata and controls
34 lines (32 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <vector>
#include <cstdio>
#include "bob.h"
#include <csignal>
#include <cstdlib>
bool bob_client_stop_flag = false;
static void onSigInt(int) {
if (!bob_client_stop_flag)
{
requestToExitBob();
bob_client_stop_flag = true;
}
else
{
printf("Pressed Ctrl+C twice, killing the process...\n");
exit(3);
}
}
// Installs a SIGINT handler that prints the summary then exits(130)
void installCtrlCPrinter() {
std::signal(SIGINT, &onSigInt);
}
int main(int argc, char *argv[]) {
installCtrlCPrinter();
try {
return runBob(argc, argv);
}
catch (std::exception &ex) {
printf("%s", ex.what());
return -1;
}
}