Friday, January 3, 2020

Re: how do I determine the status of a process within a terminal tab?

Hi,

On Sat, Jan 4, 2020 at 3:12 AM surge <gerases@gmail.com> wrote:
>
> The ":ls" command in Vim output the current buffers in Vim. If one of the buffers is a terminal, there are some useful flags to examine there. For example, if the command was
>
> :term echo "test"
>
> :ls will contain an entry similar to:
>
> 7 %aF "!echo "test" [finished]" line 1
>
> Question: is there a vimscript function that could return such extended information about a buffer?
>

Yes. You can use the term_getstatus() function to get the status of
the terminal.
You can use the getbufinfo(), term_getjob() and job_info() functions to get
additional details about the job running in a terminal window.

Example (assuming the buffer number for the terminal is 2):
:echo term_getjob(2)->job_info()
:echo term_getstatus(2)
:echo term_getjob(2)->job_status()
:echo getbufinfo(2)[0].name

- Yegappan

>
> :help terminal suggests that if modifiable option is off, the job had to have finished. Namely,
>
>> before changes can be made to a terminal buffer, the 'modifiable' option must be set. This is only possible when the job has finished:
>
>
> So, is examining the modifiable option the best way to determine if a shell process has finished? What if I wanted to examine the exis status?
>

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAAW7x7kcARmpjUmf69kasJCqt3-bH7axpjjBVJ_ZnHUvyj3kKA%40mail.gmail.com.

No comments: