下面的命令在 IRB 中有效,但在 Ruby 程序中无效。
DISPLAY=:5 nohup firefox youtube.com &
在irb
它成功返回:
nohup: redirecting stderr to stdout
当在反引号(“`”)中从 Ruby 程序调用时,它返回:
** (firefox:12402): WARNING **: Could not connect: Connection refused
** (firefox:12470): CRITICAL **: unable to create '/var/www/.cache/dconf'; dconf will not work properly.
Xlib: extension "RANDR" missing on display ":5".
Failed to stat home directory /var/www: No such file or directory
(firefox:12470): GConf-WARNING **: Client failed to connect to the D-BUS daemon:
Failed to connect to socket /tmp/dbus-989cWYOeP6: Connection refused