summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0863
diff options
context:
space:
mode:
authorSam Bingner <sam@bingner.com>2019-06-05 22:02:50 -1000
committerSam Bingner <sam@bingner.com>2019-06-05 22:02:50 -1000
commita255618e22152ca2e5fd361a3d0762e9db20dd80 (patch)
tree5c98f76c0de0785b8d5b58ac622da34f0d024a8f /data/vim/patches/8.1.0863
parent1b1fa61507a809a66f053a8523f883b2b6a2f487 (diff)
Update vim to 8.1.1471
Diffstat (limited to 'data/vim/patches/8.1.0863')
-rw-r--r--data/vim/patches/8.1.0863191
1 files changed, 191 insertions, 0 deletions
diff --git a/data/vim/patches/8.1.0863 b/data/vim/patches/8.1.0863
new file mode 100644
index 000000000..f1b2567ae
--- /dev/null
+++ b/data/vim/patches/8.1.0863
@@ -0,0 +1,191 @@
+To: vim_dev@googlegroups.com
+Subject: Patch 8.1.0863
+Fcc: outbox
+From: Bram Moolenaar <Bram@moolenaar.net>
+Mime-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+------------
+
+Patch 8.1.0863
+Problem: Cannot see what signal caused a job to end.
+Solution: Add "termsig" to job_info(). (Ozaki Kiichi, closes #3786)
+Files: runtime/doc/eval.txt, src/channel.c, src/os_unix.c, src/structs.h,
+ src/testdir/test_channel.vim
+
+
+*** ../vim-8.1.0862/runtime/doc/eval.txt 2019-01-29 22:58:02.397136325 +0100
+--- runtime/doc/eval.txt 2019-01-31 15:43:59.196879123 +0100
+***************
+*** 5711,5716 ****
+--- 5745,5755 ----
+ "exit_cb" function to be called on exit
+ "stoponexit" |job-stoponexit|
+
++ Only in Unix:
++ "termsig" the signal which terminated the process
++ (See |job_stop()| for the values)
++ only valid when "status" is "dead"
++
+ Without any arguments, returns a List with all Job objects.
+
+ job_setoptions({job}, {options}) *job_setoptions()*
+*** ../vim-8.1.0862/src/channel.c 2019-01-29 22:29:03.550799929 +0100
+--- src/channel.c 2019-01-31 15:41:28.489759542 +0100
+***************
+*** 5152,5157 ****
+--- 5152,5160 ----
+ vim_free(job->jv_tty_in);
+ vim_free(job->jv_tty_out);
+ vim_free(job->jv_stoponexit);
++ #ifdef UNIX
++ vim_free(job->jv_termsig);
++ #endif
+ free_callback(job->jv_exit_cb, job->jv_exit_partial);
+ if (job->jv_argv != NULL)
+ {
+***************
+*** 5908,5913 ****
+--- 5911,5919 ----
+ dict_add_number(dict, "exitval", job->jv_exitval);
+ dict_add_string(dict, "exit_cb", job->jv_exit_cb);
+ dict_add_string(dict, "stoponexit", job->jv_stoponexit);
++ #ifdef UNIX
++ dict_add_string(dict, "termsig", job->jv_termsig);
++ #endif
+
+ l = list_alloc();
+ if (l != NULL)
+*** ../vim-8.1.0862/src/os_unix.c 2019-01-27 16:55:44.276707556 +0100
+--- src/os_unix.c 2019-01-31 15:46:43.263894208 +0100
+***************
+*** 5655,5660 ****
+--- 5655,5677 ----
+ close(pty_slave_fd);
+ }
+
++ static char_u *
++ get_signal_name(int sig)
++ {
++ int i;
++ char_u numbuf[NUMBUFLEN];
++
++ if (sig == SIGKILL)
++ return vim_strsave((char_u *)"kill");
++
++ for (i = 0; signal_info[i].sig != -1; i++)
++ if (sig == signal_info[i].sig)
++ return strlow_save((char_u *)signal_info[i].name);
++
++ vim_snprintf((char *)numbuf, NUMBUFLEN, "%d", sig);
++ return vim_strsave(numbuf);
++ }
++
+ char *
+ mch_job_status(job_T *job)
+ {
+***************
+*** 5691,5698 ****
+ if (WIFSIGNALED(status))
+ {
+ job->jv_exitval = -1;
+! if (job->jv_status < JOB_ENDED)
+! ch_log(job->jv_channel, "Job terminated by a signal");
+ goto return_dead;
+ }
+ return "run";
+--- 5708,5717 ----
+ if (WIFSIGNALED(status))
+ {
+ job->jv_exitval = -1;
+! job->jv_termsig = get_signal_name(WTERMSIG(status));
+! if (job->jv_status < JOB_ENDED && job->jv_termsig != NULL)
+! ch_log(job->jv_channel, "Job terminated by signal \"%s\"",
+! job->jv_termsig);
+ goto return_dead;
+ }
+ return "run";
+***************
+*** 5738,5744 ****
+--- 5757,5766 ----
+ /* LINTED avoid "bitwise operation on signed value" */
+ job->jv_exitval = WEXITSTATUS(status);
+ else if (WIFSIGNALED(status))
++ {
+ job->jv_exitval = -1;
++ job->jv_termsig = get_signal_name(WTERMSIG(status));
++ }
+ if (job->jv_status < JOB_ENDED)
+ {
+ ch_log(job->jv_channel, "Job ended");
+*** ../vim-8.1.0862/src/structs.h 2019-01-26 17:28:22.232599086 +0100
+--- src/structs.h 2019-01-31 15:41:28.493759517 +0100
+***************
+*** 1550,1556 ****
+ char_u *jv_tty_in; /* controlling tty input, allocated */
+ char_u *jv_tty_out; /* controlling tty output, allocated */
+ jobstatus_T jv_status;
+! char_u *jv_stoponexit; /* allocated */
+ int jv_exitval;
+ char_u *jv_exit_cb; /* allocated */
+ partial_T *jv_exit_partial;
+--- 1550,1559 ----
+ char_u *jv_tty_in; /* controlling tty input, allocated */
+ char_u *jv_tty_out; /* controlling tty output, allocated */
+ jobstatus_T jv_status;
+! char_u *jv_stoponexit; /* allocated */
+! #ifdef UNIX
+! char_u *jv_termsig; /* allocated */
+! #endif
+ int jv_exitval;
+ char_u *jv_exit_cb; /* allocated */
+ partial_T *jv_exit_partial;
+*** ../vim-8.1.0862/src/testdir/test_channel.vim 2019-01-29 22:58:02.401136295 +0100
+--- src/testdir/test_channel.vim 2019-01-31 15:41:28.493759517 +0100
+***************
+*** 2002,2004 ****
+--- 2002,2028 ----
+ unlet g:out
+ endtry
+ endfunc
++
++ func Test_job_exitval_and_termsig()
++ if !has('unix')
++ return
++ endif
++
++ " Terminate job normally
++ let cmd = ['echo']
++ let job = job_start(cmd)
++ call WaitForAssert({-> assert_equal("dead", job_status(job))})
++ let info = job_info(job)
++ call assert_equal(0, info.exitval)
++ call assert_equal("", info.termsig)
++
++ " Terminate job by signal
++ let cmd = ['sleep', '10']
++ let job = job_start(cmd)
++ sleep 10m
++ call job_stop(job)
++ call WaitForAssert({-> assert_equal("dead", job_status(job))})
++ let info = job_info(job)
++ call assert_equal(-1, info.exitval)
++ call assert_equal("term", info.termsig)
++ endfunc
+*** ../vim-8.1.0862/src/version.c 2019-01-31 15:34:35.864056935 +0100
+--- src/version.c 2019-01-31 15:43:04.689200630 +0100
+***************
+*** 785,786 ****
+--- 785,788 ----
+ { /* Add new patch number below this line */
++ /**/
++ 863,
+ /**/
+
+--
+It's not hard to meet expenses, they're everywhere.
+
+ /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///