emacs – 如何在后台执行shell命令?
发布时间:2020-12-15 21:41:36 所属栏目:安全 来源:网络整理
导读:这是一个简单的defun来运行 shell脚本: (defun bk-konsoles () "Calls: bk-konsoles.bash" (interactive) (shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") (if (buffer-file-name) (file-name-directory (buffer-file-n
这是一个简单的defun来运行
shell脚本:
(defun bk-konsoles () "Calls: bk-konsoles.bash" (interactive) (shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") (if (buffer-file-name) (file-name-directory (buffer-file-name))) " &") nil nil)) 如果我启动一个没有&符号的程序 – 它启动脚本,但阻止emacs直到我关闭程序,如果我没有输入&符号它会给出错误: /home/boris/its/plts/goodies/bk-konsoles.bash /home/boris/scl/geekgeek/: exited abnormally with code 1. 编辑: 所以现在我正在使用: (defun bk-konsoles () "Calls: bk-konsoles.bash" (interactive) (shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") (if (buffer-file-name) (file-name-directory (buffer-file-name))) " & disown") nil nil) (kill-buffer "*Shell Command Output*")) 编辑2: 不 – 不起作用: (defun bk-konsoles () "Calls: bk-konsoles.bash" (interactive) (let ((curDir default-directory)) ;; (shell-command (concat "nohup " (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") curDir) nil nil) (shell-command (concat (expand-file-name "~/its/plts/goodies/bk-konsoles.bash ") curDir "& disown") nil nil) (kill-buffer "*Shell Command Output*"))) 让emacs忙碌 – 无论是disown还是nohup. 这是我正在运行的脚本,如果它可能有帮助:bk-konsoles.bash 解决方法
我认为问题是konsole.
(shell-command "xterm &") 做你期望的,在新窗口中打开一个xterm并将控制权返回给Emacs.然而, (shell-command "konsole &") 立即打开和关闭konsole.关于konsole启动方式的一些事情似乎正在引发这个问题.我认为KDE应用程序有自己的系统来启动应用程序,但我不确定.无论如何,我认为问题不在于Emacs方面. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容