To: vim-dev@vim.org Subject: Patch 6.1.066 (extra) Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.066 (extra) Problem: When calling system() in a plugin reading stdin hangs. Solution: Don't set the terminal to RAW mode when it wasn't in RAW mode before the system() call. Files: src/os_amiga.c, src/os_msdos.c, src/os_riscos.c, src/os_unix.c, src/os_win16.c, src/os_win32.c *** ../vim61.065/src/os_amiga.c Mon Mar 11 21:48:28 2002 --- src/os_amiga.c Wed May 15 21:51:07 2002 *************** *** 1129,1134 **** --- 1129,1135 ---- { BPTR mydir; int x; + int tmode = cur_tmode; #ifdef AZTEC_C int use_execute; char_u *shellcmd = NULL; *************** *** 1315,1321 **** if (mydir = CurrentDir(mydir)) /* make sure we stay in the same directory */ UnLock(mydir); ! settmode(TMODE_RAW); /* set to raw mode */ #ifdef FEAT_TITLE resettitle(); #endif --- 1316,1323 ---- if (mydir = CurrentDir(mydir)) /* make sure we stay in the same directory */ UnLock(mydir); ! if (tmode == TMODE_RAW) ! settmode(TMODE_RAW); /* set to raw mode */ #ifdef FEAT_TITLE resettitle(); #endif *** ../vim61.065/src/os_msdos.c Mon Mar 11 21:46:29 2002 --- src/os_msdos.c Wed May 15 21:49:12 2002 *************** *** 2103,2108 **** --- 2103,2109 ---- int options) { int x; + int tmode = cur_tmode; #ifndef DJGPP char_u *newcmd; #endif *************** *** 2152,2158 **** signal(SIGQUIT, SIG_DFL); signal(SIGTERM, SIG_DFL); #endif ! settmode(TMODE_RAW); /* set to raw mode */ set_interrupts(TRUE); /* catch interrupts */ if (x && !(options & SHELL_SILENT) && !emsg_silent) --- 2153,2160 ---- signal(SIGQUIT, SIG_DFL); signal(SIGTERM, SIG_DFL); #endif ! if (tmode == TMODE_RAW) ! settmode(TMODE_RAW); /* set to raw mode */ set_interrupts(TRUE); /* catch interrupts */ if (x && !(options & SHELL_SILENT) && !emsg_silent) *** ../vim61.065/src/os_riscos.c Mon Mar 11 22:10:01 2002 --- src/os_riscos.c Wed May 15 21:51:48 2002 *************** *** 796,801 **** --- 796,802 ---- int options; /* SHELL_*, see vim.h */ { int retval; + int tmode = cur_tmode; if (cmd == NULL) cmd = (char_u *) "GOS"; *************** *** 816,822 **** EMSG(strerror(EOPSYS)); /* Doesn't seem to set errno? */ swi(OS_Byte, 229, 1, 0); /* Re-disable escape */ ! settmode(TMODE_RAW); /* set to raw mode */ return retval ? FAIL : OK; } --- 817,824 ---- EMSG(strerror(EOPSYS)); /* Doesn't seem to set errno? */ swi(OS_Byte, 229, 1, 0); /* Re-disable escape */ ! if (tmode == TMODE_RAW) ! settmode(TMODE_RAW); /* set to raw mode */ return retval ? FAIL : OK; } *** ../vim61.065/src/os_unix.c Sun May 5 14:35:03 2002 --- src/os_unix.c Wed May 15 21:53:03 2002 *************** *** 2980,2985 **** --- 2980,2986 ---- char *ifn = NULL; char *ofn = NULL; #endif + int tmode = cur_tmode; #ifdef USE_SYSTEM /* use system() to start the shell: simple but slow */ int x; #ifndef __EMX__ *************** *** 3074,3080 **** msg_putchar('\n'); } ! settmode(TMODE_RAW); /* set to raw mode */ #ifdef FEAT_TITLE resettitle(); #endif --- 3075,3082 ---- msg_putchar('\n'); } ! if (tmode == TMODE_RAW) ! settmode(TMODE_RAW); /* set to raw mode */ #ifdef FEAT_TITLE resettitle(); #endif *************** *** 3667,3673 **** * Set to raw mode right now, otherwise a CTRL-C after * catch_signals() will kill Vim. */ ! settmode(TMODE_RAW); did_settmode = TRUE; set_signals(); --- 3669,3676 ---- * Set to raw mode right now, otherwise a CTRL-C after * catch_signals() will kill Vim. */ ! if (tmode == TMODE_RAW) ! settmode(TMODE_RAW); did_settmode = TRUE; set_signals(); *************** *** 3698,3704 **** error: if (!did_settmode) ! settmode(TMODE_RAW); /* set to raw mode */ #ifdef FEAT_TITLE resettitle(); #endif --- 3701,3708 ---- error: if (!did_settmode) ! if (tmode == TMODE_RAW) ! settmode(TMODE_RAW); /* set to raw mode */ #ifdef FEAT_TITLE resettitle(); #endif *** ../vim61.065/src/os_win16.c Mon Aug 27 17:30:04 2001 --- src/os_win16.c Wed May 15 21:53:39 2002 *************** *** 510,516 **** char_u *cmd, int options) /* SHELL_, see vim.h */ { ! int x; out_flush(); --- 510,517 ---- char_u *cmd, int options) /* SHELL_, see vim.h */ { ! int x; ! int tmode = cur_tmode; out_flush(); *************** *** 571,577 **** } } ! settmode(TMODE_RAW); /* set to raw mode */ if (x && !(options & SHELL_SILENT) && !emsg_silent) { --- 572,579 ---- } } ! if (tmode == TMODE_RAW) ! settmode(TMODE_RAW); /* set to raw mode */ if (x && !(options & SHELL_SILENT) && !emsg_silent) { *** ../vim61.065/src/os_win32.c Sat Apr 20 21:50:49 2002 --- src/os_win32.c Wed May 15 21:54:22 2002 *************** *** 2865,2871 **** char_u *cmd, int options) /* SHELL_*, see vim.h */ { ! int x = 0; #ifdef FEAT_TITLE char szShellTitle[512]; --- 2873,2880 ---- char_u *cmd, int options) /* SHELL_*, see vim.h */ { ! int x = 0; ! int tmode = cur_tmode; #ifdef FEAT_TITLE char szShellTitle[512]; *************** *** 3026,3032 **** } } ! settmode(TMODE_RAW); /* set to raw mode */ /* Print the return value, unless "vimrun" was used. */ if (x != 0 && !(options & SHELL_SILENT) && !emsg_silent --- 3035,3042 ---- } } ! if (tmode == TMODE_RAW) ! settmode(TMODE_RAW); /* set to raw mode */ /* Print the return value, unless "vimrun" was used. */ if (x != 0 && !(options & SHELL_SILENT) && !emsg_silent *** ../vim61.065/src/version.c Wed May 15 21:02:09 2002 --- src/version.c Wed May 15 21:57:11 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 66, /**/ -- Shift happens. -- Doppler /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///