1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-07-06 03:57:56 +02:00

re-adding until better solution found

This commit is contained in:
Jfreegman 2014-08-03 15:31:56 -04:00
parent 79372cc80d
commit bc4a730e76

View File

@ -83,6 +83,7 @@ static void catch_SIGINT(int sig)
static void catch_SIGSEGV(int sig) static void catch_SIGSEGV(int sig)
{ {
freopen("/dev/tty", "w", stderr);
endwin(); endwin();
fprintf(stderr, "Caught SIGSEGV: Aborting toxic session.\n"); fprintf(stderr, "Caught SIGSEGV: Aborting toxic session.\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -127,6 +128,7 @@ void exit_toxic_err(const char *errmsg, int errcode)
if (errmsg == NULL) if (errmsg == NULL)
errmsg = "No error message"; errmsg = "No error message";
freopen("/dev/tty", "w", stderr);
endwin(); endwin();
fprintf(stderr, "Toxic session aborted with error code %d (%s)\n", errcode, errmsg); fprintf(stderr, "Toxic session aborted with error code %d (%s)\n", errcode, errmsg);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -700,6 +702,10 @@ int main(int argc, char *argv[])
line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, msg); line_info_add(prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, msg);
} }
/* Redirect stderr to /dev/null
NOTE: Might not be best solution. Comment out for debugging. */
freopen("/dev/null", "w", stderr);
uint64_t last_save = (uint64_t) time(NULL); uint64_t last_save = (uint64_t) time(NULL);
uint64_t looptimer = last_save; uint64_t looptimer = last_save;
useconds_t msleepval = 40000; useconds_t msleepval = 40000;