Consider the following example:
term_start(myprogram, {exit_cb: MyExitHandler})
def MyExitHandler()
if exit_status != 0
echom "Error!"
endif
enddef
The function MyExitHandler
is called when myprogram
encounter some error OR when I wipe out the terminal buffer running myprogram
.
In both cases echom "Error!"
is run. The program myprogram
has only two exit statuses: 0 (success) and 1 (failure).
Is there a way where I can distinguish when myprogram
detect an error and when the terminal buffer is wiped out so that I can have two different messages? If so how?
:help term_setkill()
,:help term_getjob()
, and:help job_info()
.