私はバックグラウンドオプション&でプロセスを開始しているシェルスクリプトを実行しています。シェルスクリプトは、Pythonスクリプトから呼び出され、ハングします。サブプロセスpopen Python
シェルスクリプト:
test -f filename -d &
のpythonファイル
cmd =["shellscript","restart"]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stdin=subprocess.PIPE, **kwargs)
pid = proc.pid
out, err = proc.communicate()
returncode = proc.poll()
Pythonのファイルがハングし、それはPythonのプロセスから戻りません。また、pythonプロセスは自動化されたものです。
"cmd"とは何ですか? – Hannu
cmdはリスト[ restart]以外の何ものでもありません。 –
Shriram
'test -f filename -d&'は有効なコマンドのようには見えません。少なくとも 'test'が標準のposixテストバイナリまたはシェル組み込みコマンドである場合は、少なくともです。これは単なる他のもののプレースホルダですか? – mata