非阻塞命令过程

时间:2018-12-10 20:51:43

标签: python jupyter-notebook jupyter

我正在尝试运行命令:

! sudo chromium-browser --no-sandbox www.google.com

通过命令行

我也尝试过:

! sudo chromium-browser --no-sandbox www.google.com

并添加到sh脚本文件中,输出为:

sudo ./ruunn.sh
 --disable-quic --enable-tcp-fast-open --disable-gpu-compositing --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=
Fontconfig warning: "/etc/fonts/fonts.conf", line 160: blank doesn't take any effect anymore. please remove it from your fonts.conf
[8232:8232:1210/204151.324275:ERROR:gpu_process_transport_factory.cc(1029)] Lost UI shared context.
[8232:8327:1210/204151.671927:ERROR:bus.cc(394)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
ATTENTION: default value of option force_s3tc_enable overridden by environment.
[8331:8331:1210/204154.008745:ERROR:sandbox_linux.cc(375)] InitializeSandbox() called with multiple threads in process gpu-process.

浏览器成功打开。问题是python脚本没有返回,阻止了其他命令的执行。有没有办法执行命令而不会阻塞?我正在jupyter笔记本中执行这些命令。

2 个答案:

答案 0 :(得分:0)

如果使用&跟踪bash命令,则该命令将变为非阻塞状态。有关here

的更多信息
  

使用&会在后台启动进程,因此您可以继续使用外壳程序,而不必等到脚本完成后。

所以对于你的情况

! sudo chromium-browser --no-sandbox www.google.com &

答案 1 :(得分:0)

您应该看看screen command