PHOENIX-5594 Different permission of phoenix-*-queryserver.log from umask (Toshihiro Suzuki)
diff --git a/bin/queryserver.py b/bin/queryserver.py
index 0c07b3b..26d096c 100755
--- a/bin/queryserver.py
+++ b/bin/queryserver.py
@@ -148,6 +148,10 @@
print >> sys.stderr, "daemon mode not supported on this platform"
sys.exit(-1)
+ # get the current umask for the sub process
+ current_umask = os.umask(0)
+ os.umask(current_umask)
+
# run in the background
d = os.path.dirname(out_file_path)
if not os.path.exists(d):
@@ -171,8 +175,12 @@
sys.exit(0)
signal.signal(signal.SIGTERM, handler)
+ def initsubproc():
+ # set the parent's umask
+ os.umask(current_umask)
+
print '%s launching %s' % (datetime.datetime.now(), cmd)
- child = subprocess.Popen(cmd.split())
+ child = subprocess.Popen(cmd.split(), preexec_fn=initsubproc)
sys.exit(child.wait())
elif command == 'stop':