Browse Source

Fix waiting for child processes

Serj Kalichev 6 years ago
parent
commit
cfdd11e7ba
2 changed files with 2 additions and 2 deletions
  1. 1 1
      clish/shell/shell_execute.c
  2. 1 1
      plugins/clish/sym_script.c

+ 1 - 1
clish/shell/shell_execute.c

@@ -273,7 +273,7 @@ static int clish_shell_exec_oaction(clish_hook_oaction_fn_t func,
 	konf_buf_delete(buf);
 	close(pipe2[0]);
 	/* Wait for the stdout-grabber process */
-	waitpid(cpid, NULL, 0);
+	while (waitpid(cpid, NULL, 0) != cpid);
 
 	return result;
 

+ 1 - 1
plugins/clish/sym_script.c

@@ -85,7 +85,7 @@ CLISH_PLUGIN_OSYM(clish_script)
 
 	/* Wait for the writing process */
 	kill(cpid, SIGTERM);
-	waitpid(cpid, NULL, 0);
+	while (waitpid(cpid, NULL, 0) != cpid);
 
 	/* Clean up */
 	lub_string_free(command);