我们在启动subprocess.Popen
气流操作员时遇到问题。我们使用以下代码启动 sqlcl:
import subprocess
cmd = '/usr/local/bin/sqlcl -V'
p = subprocess.Popen(
cmd, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
text=True,
executable='/bin/bash')
for line in iter(p.stdout.readline, ''):
self.log.info('%s', line)
p.wait()
# we have also tried p.communicate() and p.poll() here
上面的代码片段在从 ipython 运行时有效,但在从气流中运行时挂起且没有输出。有什么建议么?