Commits

Anonymous committed 1c2eb86

Fix SIGINT handling in forked mode.

Ignore SIGINT in parent process while waiting for pickled output. This
way we can nicely handle SIGINT within child and return the incomplete
package list.

  • Participants
  • Parent commits 1ccca1b

Comments (0)

Files changed (1)

smart-live-rebuild.py

 		else:
 			os.close(commpipe[1])
 			pipe = os.fdopen(commpipe[0], 'rb')
-			pdata = pickle.load(pipe)
+			sigint = signal.getsignal(signal.SIGINT)
+			signal.signal(signal.SIGINT, signal.SIG_IGN)
+			try:
+				pdata = pickle.load(pipe)
+			except EOFError: # child terminated early
+				return 1
+			signal.signal(signal.SIGINT, sigint)
 			packages = pdata['packages']
 			erraneous = pdata['erraneous']