create pid file only after espeakup is ready

Samuel Thibault samuel.thibault at ens-lyon.org
Thu Jun 30 14:46:37 EDT 2011


Hello,

For proper language switch in the debian installer, I had to fix the
creation of the espeakup pid file: if it is created too early, the
installer continues too early, and the following question is missed by
espeakup. The attached patch fixes it by creating the pid file only once
everything is ready.

Samuel
-------------- next part --------------
diff --git a/espeakup.c b/espeakup.c
index 7157b0a..ae7ec8d 100644
--- a/espeakup.c
+++ b/espeakup.c
@@ -118,12 +118,6 @@ int main(int argc, char **argv)
 	if (!debug) {
 		/* become a daemon */
 		daemon(0, 1);
-
-		/* write our pid file. */
-		if (create_pid_file() < 0) {
-			perror("Unable to create pid file");
-			return 2;
-		}
 	}
 
 	/* initialize espeak */
@@ -147,6 +141,14 @@ int main(int argc, char **argv)
 		return 4;
 	}
 
+	if (!debug) {
+		/* We are now ready, write our pid file. */
+		if (create_pid_file() < 0) {
+			perror("Unable to create pid file");
+			return 2;
+		}
+	}
+
 	/* run the main loop */
 	main_loop(&s);
 


More information about the Speakup mailing list