Check if our stdin is a pipe in
-import psutil, os, sys, time
+import psutil, os, stat, sys, time
from tempfile import NamedTemporaryFile
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
@@ -56,6 +56,11 @@ class Sync(object):
@property
def source_proc(self):
+ mode = os.fstat(0).st_mode
+ if not stat.S_ISFIFO(mode):
+ # stdin is not a pipe
+ return None
+ else:
source = self._proc.parent().children()[0]
return None if source == self._proc else source
