comparison src/os_win32.c @ 7975:7224f5e9c36a v7.4.1283

commit https://github.com/vim/vim/commit/942d6b22686858c9e72f8b8929df5c288170179c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 7 19:57:16 2016 +0100 patch 7.4.1283 Problem: The job feature isn't available on MS-Windows. Solution: Add the job feature. Fix argument of job_stop(). (Yasuhiro Matsumoto)
author Christian Brabandt <cb@256bit.org>
date Sun, 07 Feb 2016 20:00:05 +0100
parents 3f2e0b62003d
children b421c7f2f172
comparison
equal deleted inserted replaced
7974:fe554d117c7b 7975:7224f5e9c36a
4153 else 4153 else
4154 si.wShowWindow = SW_SHOWNORMAL; 4154 si.wShowWindow = SW_SHOWNORMAL;
4155 si.cbReserved2 = 0; 4155 si.cbReserved2 = 0;
4156 si.lpReserved2 = NULL; 4156 si.lpReserved2 = NULL;
4157 4157
4158 /* There is a strange error on Windows 95 when using "c:\\command.com". 4158 /* There is a strange error on Windows 95 when using "c:\command.com".
4159 * When the "c:\\" is left out it works OK...? */ 4159 * When the "c:\\" is left out it works OK...? */
4160 if (mch_windows95() 4160 if (mch_windows95()
4161 && (STRNICMP(cmd, "c:/command.com", 14) == 0 4161 && (STRNICMP(cmd, "c:/command.com", 14) == 0
4162 || STRNICMP(cmd, "c:\\command.com", 14) == 0)) 4162 || STRNICMP(cmd, "c:\\command.com", 14) == 0))
4163 cmd += 3; 4163 cmd += 3;
5029 signal(SIGTERM, SIG_DFL); 5029 signal(SIGTERM, SIG_DFL);
5030 signal(SIGABRT, SIG_DFL); 5030 signal(SIGABRT, SIG_DFL);
5031 5031
5032 return x; 5032 return x;
5033 } 5033 }
5034
5035 #if defined(FEAT_JOB) || defined(PROTO)
5036 void
5037 mch_start_job(char *cmd, job_T *job)
5038 {
5039 STARTUPINFO si;
5040 PROCESS_INFORMATION pi;
5041
5042 ZeroMemory(&si, sizeof(si));
5043 si.cb = sizeof(si);
5044
5045 if (!vim_create_process(cmd, FALSE,
5046 CREATE_DEFAULT_ERROR_MODE |
5047 CREATE_NEW_PROCESS_GROUP |
5048 CREATE_NO_WINDOW,
5049 &si, &pi))
5050 job->jv_status = JOB_FAILED;
5051 else
5052 {
5053 job->jf_pi = pi;
5054 job->jv_status = JOB_STARTED;
5055 }
5056 }
5057
5058 char *
5059 mch_job_status(job_T *job)
5060 {
5061 DWORD dwExitCode = 0;
5062
5063 if (!GetExitCodeProcess(job->jf_pi.hProcess, &dwExitCode))
5064 return "dead";
5065 if (dwExitCode != STILL_ACTIVE)
5066 {
5067 CloseHandle(job->jf_pi.hProcess);
5068 CloseHandle(job->jf_pi.hThread);
5069 return "dead";
5070 }
5071 return "run";
5072 }
5073
5074 int
5075 mch_stop_job(job_T *job, char_u *how)
5076 {
5077 if (STRCMP(how, "kill") == 0)
5078 TerminateProcess(job->jf_pi.hProcess, 0);
5079 else
5080 return GenerateConsoleCtrlEvent(
5081 STRCMP(how, "hup") == 0 ?
5082 CTRL_BREAK_EVENT : CTRL_C_EVENT,
5083 job->jf_pi.dwProcessId) ? OK : FAIL;
5084 return OK;
5085 }
5086 #endif
5034 5087
5035 5088
5036 #ifndef FEAT_GUI_W32 5089 #ifndef FEAT_GUI_W32
5037 5090
5038 /* 5091 /*