diff --git a/espeakup.c b/espeakup.c index ffb2e42..8a55b0c 100644 --- a/espeakup.c +++ b/espeakup.c @@ -98,15 +98,9 @@ int main(int argc, char **argv) return 1; } - /* - * If we are not in debug mode, daemonize and store the pid. - */ + /* Daemonize if we are not in debug mode. */ if (!debug) { daemon(0, 1); - if (create_pid_file() < 0) { - perror("Unable to create pid file"); - return 2; - } } } @@ -153,6 +147,14 @@ int main(int argc, char **argv) return 4; } + /* Store the pid */ + if (!debug && espeakup_mode == ESPEAKUP_MODE_SPEAKUP) { + if (create_pid_file() < 0) { + perror("Unable to create pid file"); + return 2; + } + } + /* wait for the threads to shut down. */ pthread_join(signal_thread_id, NULL); pthread_join(softsynth_thread_id, NULL);