Nikolay Pavlov wrote: > 2017-04-11 23:43 GMT+03:00 Bram Moolenaar <[email protected]>: > > > > Martin Gammelsæter wrote: > > > >> I'm not sure whether this is intended or not, but it seems like there > >> currently is no way of sending SIGINT to a job through the jobs api > >> without also closing the channel. > >> > >> To reproduce: > >> > >> ``` > >> let job = job_start("bash", {"mode": "raw"}) > >> call job_stop(job, "int") > >> call ch_sendraw(job_getchannel(job), "ls\n") > >> ``` > >> Errors with `E906: not an open channel` > >> > >> Vim version 8.0.329 > > > > Currently we only check for "hup". We should probably do it the other > > way around, only assume a job gets killed by "term" and "kill". > > SIGTERM may be ignored. Also provoke doing something (including > writing to the channel) before exiting. I do not know how second > variant is going to be handled, but first definitely implies that > `term` needs not close a channel. > > And I would rather go explicit: *no* signals close the channel at all, > channel should only be closed explicitly or when corresponding file > descriptor is closed by the child (or by its death).
It's possible. Although I would think that after killing a job the channel should not be used, that smells like wrong behavior. > BTW, I found in `:h job_stop()` “The status of the job isn't checked, > the operation will even be done when Vim thinks the job isn't > running.” Does this mean that Vim will kill random process which > happened to take former jobs PID if job happened to die and be > collected (as opposed to leaving a zombie) in this case? Even when we would check if the job exists, it could still be another one. Perhaps using waitpid() might work. We could check job->jv_status. -- Why doesn't Tarzan have a beard? /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
