From 14fe7af771a4fd9fb2e409276a4e247fac42beae Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Thu, 7 Jun 2012 14:13:17 -0700 Subject: [PATCH] Fixed reporting of processes that failed to start after 'Run' or 'Debug' commands --- src/editor/output.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/editor/output.lua b/src/editor/output.lua index 42646596da..66624266fb 100644 --- a/src/editor/output.lua +++ b/src/editor/output.lua @@ -124,16 +124,20 @@ function CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback) end -- launch process - local pid = (proc and wx.wxExecute(cmd, wx.wxEXEC_ASYNC + (nohide and wx.wxEXEC_NOHIDE or 0),proc) or - wx.wxExecute(cmd, wx.wxEXEC_ASYNC + (nohide and wx.wxEXEC_NOHIDE or 0))) + local pid = (proc + and wx.wxExecute(cmd, wx.wxEXEC_ASYNC + (nohide and wx.wxEXEC_NOHIDE or 0),proc) + or wx.wxExecute(cmd, wx.wxEXEC_ASYNC + (nohide and wx.wxEXEC_NOHIDE or 0))) if (oldcwd) then wx.wxFileName.SetCwd(oldcwd) end - -- check process - if not pid or pid == -1 then - DisplayOutputNoMarker("Unknown ERROR Running program!\n") + -- For asynchronous execution, he return value is the process id and + -- zero value indicates that the command could not be executed. + -- The return value of -1 in this case indicates that we didn't launch + -- a new process, but connected to the running one (e.g. DDE under Windows). + if not pid or pid == -1 or pid == 0 then + DisplayOutput("Unable to run program: "..cmd.."\n") customproc = nil return else