Skip to content

Commit

Permalink
Bug fix for execute() implementation in DLL
Browse files Browse the repository at this point in the history
Before I published the plug-in I tested the execute() / CreateProcess()
implementation by comparing the results of executing the interactive,
graphical program Notepad using Vim's system() function and my execute()
implementation, simply as a demonstration of a child process blocking
further input in Vim until the child process dies.

In the test above my execute() implementation works great, but my actual
goal with the execute() function is to run programs such as Exuberant
Ctags without waiting for them to finish AND without creating a command
prompt window. And of course I was stupid enough not to test my actual
use-case first... Turns out the code as it was would still create a
command prompt window to run command-line programs, it just appeared to
not show command prompt windows simply because Notepad is a GUI program.
  • Loading branch information
xolox committed Jun 13, 2010
1 parent 92baa3f commit c46f8e5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions dll/shell.c
Expand Up @@ -64,13 +64,12 @@ static char *Failure(char *result)
__declspec(dllexport)
char *execute(char *command)
{
/* TODO: Use CREATE_NO_WINDOW and/or DETACHED_PROCESS? */
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
ZeroMemory(&pi, sizeof(pi));
si.cb = sizeof(si);
if (CreateProcess(0, command, 0, 0, 0, 0, 0, 0, &si, &pi)) {
if (CreateProcess(0, command, 0, 0, 0, CREATE_NO_WINDOW, 0, 0, &si, &pi)) {
return Success(NULL);
} else {
return Failure(GetError());
Expand Down

0 comments on commit c46f8e5

Please sign in to comment.