执行通常包含 '\;' 的 tmux 命令使用 subprocess.run
executing a tmux command normally containing '\;' using subprocess.run
首先,是的。我确实阅读了有关此问题的一些问题,并且我确实理解应该不需要转义(我什至指定了 shell=False
)。
我的问题是
subprocess.run(['tmux', '-n top', 'top', '; neww'])
导致 tmux 会话打开并立即关闭
我正在尝试实现与执行相同的结果
tmux new -n top top \; neww
在 shell.
我也试过指定 shell=True
并使用 '\; neww'
以及 r'\; neww'
似乎也没有向 stderr 写入任何内容。
每个参数都必须是单独的:
>>> import subprocess
>>> subprocess.run(['tmux', 'new', '-d', '-n', 'top', 'top', ';', 'neww'])
CompletedProcess(args=['tmux', 'new', '-d', '-n', 'top', 'top', ';', 'neww'], returncode=0)
>>>
首先,是的。我确实阅读了有关此问题的一些问题,并且我确实理解应该不需要转义(我什至指定了 shell=False
)。
我的问题是
subprocess.run(['tmux', '-n top', 'top', '; neww'])
导致 tmux 会话打开并立即关闭
我正在尝试实现与执行相同的结果
tmux new -n top top \; neww
在 shell.
我也试过指定 shell=True
并使用 '\; neww'
以及 r'\; neww'
似乎也没有向 stderr 写入任何内容。
每个参数都必须是单独的:
>>> import subprocess
>>> subprocess.run(['tmux', 'new', '-d', '-n', 'top', 'top', ';', 'neww'])
CompletedProcess(args=['tmux', 'new', '-d', '-n', 'top', 'top', ';', 'neww'], returncode=0)
>>>