简体   繁体   English

是否有直接的elisp方法来检查进程是否在emacs术语缓冲区中运行?

[英]Is there a direct elisp way to check if a process is running in an emacs term buffer?

I need a check for whether or not a process is still running in my emacs term; 我需要检查一个进程是否仍在我的emacs术语中运行; started via (term "/bin/bsh") and then renamed to, eg. (term "/bin/bsh") ,然后重命名为,例如。 term-A . term-A

I have tried (term-check-proc "term-A") , but it doesn't show what I what I need, or at least, I don't see how I can use it. 我已经尝试过(term-check-proc "term-A") ,但它没有显示我需要什么,或者至少,我看不出如何使用它。

Trying to chase it down by a shell call to ps afx (or the like), is problematic if there is more than one emacs term active and running the same program, (which in my case, is quite quite possible)... 如果有多个emacs term处于活动状态且运行相同的程序(在我的情况下,很可能),试图通过shell调用ps afx (或类似命令)来追逐它是有问题的......

I really need to know if a process in a specific emacs term buffer , term-A , is running or not. 我真的需要知道特定emacs术语缓冲区term-A的进程是否正在运行。

You can get a buffer's process with get-buffer-process : 您可以使用get-buffer-process

(get-buffer-process "*shell*") -> #<process shell>
(get-buffer-process "*scratch*") -> nil

After I exit the shell in *shell* , I get nil for that buffer too. *shell*退出shell之后,我也得到了该缓冲区的nil

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM