Guard against ^Z in helper programs
Resume them immediately, we are not a shell.
This commit is contained in:
		
							
								
								
									
										6
									
								
								sdn.cpp
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								sdn.cpp
									
									
									
									
									
								
							@@ -834,7 +834,11 @@ fun run_program (initializer_list<const char*> list, const string &filename) {
 | 
				
			|||||||
	default:
 | 
						default:
 | 
				
			||||||
		// ...and make sure of it in the parent as well
 | 
							// ...and make sure of it in the parent as well
 | 
				
			||||||
		(void) setpgid (child, child);
 | 
							(void) setpgid (child, child);
 | 
				
			||||||
		waitpid (child, &status, 0);
 | 
					
 | 
				
			||||||
 | 
							// We don't provide job control--don't let us hang after ^Z
 | 
				
			||||||
 | 
							while (waitpid (child, &status, WUNTRACED) > -1 && WIFSTOPPED (status))
 | 
				
			||||||
 | 
								if (WSTOPSIG (status) == SIGTSTP)
 | 
				
			||||||
 | 
									kill (child, SIGCONT);
 | 
				
			||||||
		tcsetpgrp (STDOUT_FILENO, getpgid (0));
 | 
							tcsetpgrp (STDOUT_FILENO, getpgid (0));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user