From b9e3c243d476efa04479d253cfc4f76ecbdb6fe3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 11 Jun 2010 11:00:38 -0400 Subject: [PATCH] KWSys: Teach Process to error on empty command Do not try to execute a child with no command line. Previously this led to a silent hang. --- Source/kwsys/ProcessUNIX.c | 8 ++++++++ Source/kwsys/ProcessWin32.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c index adadef15f..9c66a4486 100644 --- a/Source/kwsys/ProcessUNIX.c +++ b/Source/kwsys/ProcessUNIX.c @@ -720,6 +720,14 @@ void kwsysProcess_Execute(kwsysProcess* cp) return; } + /* Make sure we have something to run. */ + if(cp->NumberOfCommands < 1) + { + strcpy(cp->ErrorMessage, "No command"); + cp->State = kwsysProcess_State_Error; + return; + } + /* Initialize the control structure for a new process. */ if(!kwsysProcessInitialize(cp)) { diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index c5ea6db20..5aa4d8bf6 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -987,6 +987,14 @@ void kwsysProcess_Execute(kwsysProcess* cp) return; } + /* Make sure we have something to run. */ + if(cp->NumberOfCommands < 1) + { + strcpy(cp->ErrorMessage, "No command"); + cp->State = kwsysProcess_State_Error; + return; + } + /* Initialize the control structure for a new process. */ if(!kwsysProcessInitialize(cp)) {