Better behavior in case stdout was closed when irkerd was backgrounded.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 31 May 2014 16:52:50 +0000 (12:52 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 31 May 2014 16:52:50 +0000 (12:52 -0400)
irkerd

diff --git a/irkerd b/irkerd
index 2c66a1865af2ac9bbf00be586f00810e1ba93481..dd567e526a0c52521aaa237182d0867af5c14b9f 100755 (executable)
--- a/irkerd
+++ b/irkerd
@@ -937,7 +937,10 @@ class IrkerUDPHandler(socketserver.BaseRequestHandler):
 
 def in_background():
     "Is this process running in background?"
-    return os.getpgrp() !=  os.tcgetpgrp(1)
+    try:
+        return os.getpgrp() !=  os.tcgetpgrp(1)
+    except OSError:
+        return True
 
 if __name__ == '__main__':
     parser = argparse.ArgumentParser(