0

Sorry i am new in python subprocess world and I am lost a bit . We have python script run.py and from run.py we are calling another python file named start_process.py using subprocess and then in start_process.py we are starting processes using again subprocess

Basically sudo code goes like

run.py :

def call_process_script():
    cmd = "python start_process.py"
    sub_proc = subprocess.Popen(cmd)

while True:  
    call_process_script()

start_process.py:

cmd = "java somejava process"
sub_proc = subprocess.Popen(
                    cmd,stderr=subprocess.STDOUT,stdout=subprocess.PIPE
                )
stdoutdata, stderrdata = sub_proc.communicate()

Now I want to restart the java process after sometime . But I am not able to handle it or control from run.py or start_process.py.

I tried to force stop as mentioned and start but no luck Using module 'subprocess' with timeout

curiousguy
  • 3,212
  • 8
  • 39
  • 71
  • No Actually. I cant change the script you mentioned . And still trying looking at this https://www.blog.pythonlibrary.org/2016/05/17/python-101-how-to-timeout-a-subprocess/ – curiousguy Dec 23 '18 at 08:48
  • Also one observation is force stopping the `python start_process.py` not stopping the `java process` invoked by it – curiousguy Dec 23 '18 at 08:49

0 Answers0