Skip to content

Commit

Permalink
Merge branch 'ui-v2' of https://github.com/IGS/gEAR into ui-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Sep 10, 2024
2 parents 3d8a823 + a9bf900 commit 56ab430
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions www/cgi/process_uploaded_expression_dataset.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,27 @@ def main():
# This is the fork off of apache
# https://stackoverflow.com/a/22181041/1368079
# https://stackoverflow.com/questions/6024472/start-background-process-daemon-from-cgi-script
sys.stdout = original_stdout
result['success'] = 1
print(json.dumps(result))

sys.stdout.flush()
os.close(sys.stdout.fileno()) # Break web pipe
sys.stderr.flush()
os.close(sys.stderr.fileno()) # Break web pipe
# https://groups.google.com/g/comp.lang.python/c/gSRnd0RoVKY?pli=1
do_fork = True
if do_fork:
sys.stdout = original_stdout
result['success'] = 1
print(json.dumps(result))

sys.stdout.flush()
sys.stdout.close()

sys.stderr.flush()
sys.stderr.close()

if os.fork(): # Get out of parent process
sys.exit(0)
f = os.fork()

# open a log file in /tmp
f_out = open('/home/jorvis/logs/apache.stdout.log', 'w')
f_err = open('/home/jorvis/logs/apache.stderr.log', 'w')
if f != 0:
# Terminate the parent
sys.exit(0)
# PARENT DEAD

time.sleep(1) # Be sure the parent process reach exit command.
os.setsid() # Become process group leader
# CHILD CONTINUES FROM HERE

status['process_id'] = os.getpid()

Expand Down

0 comments on commit 56ab430

Please sign in to comment.