Running a secondary script in a new terminal

前端 未结 3 1198
暖寄归人
暖寄归人 2021-01-23 03:54

When running a secondary python script:

  • Is it possible to run a subprocess.Popen, or subprocess.call or even execfile in a n
3条回答
  •  既然无缘
    2021-01-23 04:15

    If you're using tmux, you can specify which target you want the command to run in:

    tmux send -t foo.0 ls ENTER
    

    So, if you've created a tmux session foo.0, you should be able to do:

    my_command = 'ls'
    tmux_cmd = ['tmux', 'send', '-t', 'foo.0', my_command]
    p = subprocess.Popen(tmux_cmd)
    

提交回复
热议问题