3
同じプロセスでプロセスを開き、2つのコマンドを実行したいとします。私は:Python:popenを使用して1つのプロセスで複数のコマンドを実行する方法
cmd1 = 'source /usr/local/../..'
cmd2 = 'ls -l'
final = Popen(cmd2, shell=True, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
stdout, nothing = final.communicate()
log = open('log', 'w')
log.write(stdout)
log.close()
私は2回popenを使用する場合、これらの2つのコマンドは異なるプロセスで実行されます。しかし、私はそれらを同じシェルで走らせたい。