diff --git a/python2/pyinotify.py b/python2/pyinotify.py index d2f0816..35fcf55 100755 --- a/python2/pyinotify.py +++ b/python2/pyinotify.py @@ -1331,11 +1331,14 @@ def fork_daemon(): # parent 1 os._exit(0) + sys.stdout.flush() + sys.stderr.flush() + fd_inp = os.open(stdin, os.O_RDONLY) os.dup2(fd_inp, 0) - fd_out = os.open(stdout, os.O_WRONLY|os.O_CREAT, 0600) + fd_out = os.open(stdout, os.O_WRONLY|os.O_CREAT|os.O_APPEND, 0600) os.dup2(fd_out, 1) - fd_err = os.open(stderr, os.O_WRONLY|os.O_CREAT, 0600) + fd_err = os.open(stderr, os.O_WRONLY|os.O_CREAT|os.O_APPEND, 0600) os.dup2(fd_err, 2) # Detach task diff --git a/python3/pyinotify.py b/python3/pyinotify.py index bc24313..80243ba 100755 --- a/python3/pyinotify.py +++ b/python3/pyinotify.py @@ -1316,11 +1316,13 @@ def fork_daemon(): # parent 1 os._exit(0) + sys.stdout.flush() + sys.stderr.flush() fd_inp = os.open(stdin, os.O_RDONLY) os.dup2(fd_inp, 0) - fd_out = os.open(stdout, os.O_WRONLY|os.O_CREAT, 0o0600) + fd_out = os.open(stdout, os.O_WRONLY|os.O_CREAT|os.O_APPEND, 0o0600) os.dup2(fd_out, 1) - fd_err = os.open(stderr, os.O_WRONLY|os.O_CREAT, 0o0600) + fd_err = os.open(stderr, os.O_WRONLY|os.O_CREAT|os.O_APPEND, 0o0600) os.dup2(fd_err, 2) # Detach task