I use Python scripts to prepare some stuff for long quantum calculations. So, when I run target binary from terminal
targetbin file.inp > file.out
I can see that process is still running. With Python I do some automations:
#!/usr/bin/env python3
# blah blah blah
cmd = ' '.join([targetbin, modified_inp_file, some_options, '>', created_out_file])
# /usr/bin/targetbin /tmp/XXX.inp -a 1 -b 2 -c 3 > file.out
subprocess.Popen(cmd, shell=True)
run it from terminal:
pythonscript -x 1 -y 2 -z 3 file.inp
and it works fine, but it doesn't hold shell. After Python initiate the process I want to delegate it completely to the shell and then exit Python itself, as if I entered cmd
myself. Is it possible?
You can try this way -
fg
. (Alternatively, you can get the PID
from python and run kill -CONT <pid>
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.