From ddf4460bb8233d5d8ac9015b1ef34316d9681e23 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 23 Jan 2015 08:48:34 +0000 Subject: sourcedit: do not wait indefinitely if $EDITOR is stopped Users may hit Ctrl-Z to stop their editor during editing and trigger SICHLD, do not waitpid2 indefinitely in that case. This prevents missed "source ed" calls for inotify users. --- bin/dtas-sourceedit | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'bin/dtas-sourceedit') diff --git a/bin/dtas-sourceedit b/bin/dtas-sourceedit index 646058f..bf9e829 100755 --- a/bin/dtas-sourceedit +++ b/bin/dtas-sourceedit @@ -76,7 +76,8 @@ else r[0].each do |io| case io when sev - _, status = Process.waitpid2(pid) + _, status = Process.waitpid2(pid, Process::WNOHANG) + status or next status.success? or abort "#{cmd} failed: #{status.inspect}" do_update.call exit -- cgit v1.2.3-24-ge0c7