emacs - Elisp 如何在退出之前向子进程提供带有 process-send-string 的命令

标签 emacs elisp

代码:

(progn
   (start-process "my-process" "my-process-output" "bash")
   (process-send-string "my-process" "ls -al ~"))

运行时,我只得到

bash-3.2$ 

“my-process”是否在“process-send-string”之前终止?我的目标并不是特别向“bash”进程发出命令。它实际上更通用 - 即使用 process-send-string 将命令提供给现有的子进程。我尝试将 nil 参数传递给 start-process,希望 emacs 在传递给任何具体参数之前以某种方式为我启动一个进程占位符,但这也没有帮助。

(progn
   (start-process "my-process" "my-process-output" nil)
   (process-send-string "my-process" "bash -c \"ls -al ~\""))

这样做的方法是什么?

最佳答案

在输入 ls 命令后尝试使用换行符(按 Enter 键):

(process-send-string "my-process" "ls -al ~\n"))

关于emacs - Elisp 如何在退出之前向子进程提供带有 process-send-string 的命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19193235/

相关文章:

python - 管理助手死亡

emacs:强制 ido 模式忘记历史

emacs - 如何在 emacs 组织模式中启用并行 PDF 导出

emacs - elisp 中的属性列表

c - Emacs 中的 Linux 内核标记

shell - Emacs 中 char 运行模式 (ansi-term) 的键盘快捷键

Emacs 口齿不清 : Can't set any value to variable named 's'

c++ - 尝试使用 prelude 设置 ggtags 和 flycheck 时错误的 emacs 配置

ubuntu - 无法让 nrepl 在 Emacs 中工作

scala - 运行 ensime-source-buffer-loaded-hook 时出错 - 使用 ENSIME 和 Emacs 的 OSX