Fixed an issue with running processes not terminated when closing IDE.

This was a side-effect of an earlier change that was done to run
end-callbacks before terminating external processes (as those callbacks
may be used, for example, to remove temporary files).

Many of interpreters had logic in those callbacks to reset debugger.pid,
which was useful (at a time) to reset UI after terminatin of a process
(introduced by 4554c67c). However, this logic was unnecesary in
interpreters and interfered with terminating running processes, so this
commit removes it from all the interpreters and does in the IDE itself.
This commit is contained in:
Paul Kulchenko
2014-04-11 15:24:26 -07:00
parent 9284a24750
commit 78c44e6060
11 changed files with 12 additions and 19 deletions

View File

@@ -53,7 +53,7 @@ return {
local cmd = ('"%s" %s "%s"'):format(busted, options, file)
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil if rundebug then wx.wxRemoveFile(file) end end)
function() if rundebug then wx.wxRemoveFile(file) end end)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)

View File

@@ -82,8 +82,7 @@ return {
local cmd = ('"%s" %s"%s"%s')
:format(corona, rundebug and debugopt or "", file, skin)
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil end)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)

View File

@@ -90,8 +90,7 @@ return {
else
local cmd = ('"%s"'):format(gideros)
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
pid = CommandLineRun(cmd,self:fworkdir(wfilename),not mac,true,nil,nil,
function() ide.debugger.pid = nil end)
pid = CommandLineRun(cmd,self:fworkdir(wfilename),not mac,true)
if not pid then return end
end

View File

@@ -82,7 +82,7 @@ return {
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil if rundebug then wx.wxRemoveFile(filepath) end end)
function() if rundebug then wx.wxRemoveFile(filepath) end end)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)

View File

@@ -46,8 +46,7 @@ return {
end
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
local pid = CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil end)
local pid = CommandLineRun(cmd,self:fworkdir(wfilename),true,false)
-- restore PATH
wx.wxSetEnv("PATH", path)

View File

@@ -46,8 +46,7 @@ return {
local cmd = ('"%s" "%s"%s%s'):format(love2d, self:fworkdir(wfilename),
params and " "..params or "", rundebug and ' -debug' or '')
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil end)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)

View File

@@ -57,7 +57,7 @@ return {
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
local pid = CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil if rundebug then wx.wxRemoveFile(filepath) end end)
function() if rundebug then wx.wxRemoveFile(filepath) end end)
if version and cpath then wx.wxSetEnv("LUA_CPATH", cpath) end
return pid

View File

@@ -60,10 +60,7 @@ return {
local cmd = '"'..exe..'" '..args
local pid = CommandLineRun(cmd,wdir,true,true,nil,self:fuid(wfilename),
function() ide.debugger.pid = nil end)
return pid
return CommandLineRun(cmd,wdir,true,true,nil,self:fuid(wfilename))
end,
fuid = function(self,wfilename) return "luxinia2: luajit "..wfilename:GetFullName() end,
fprojdir = function(self,wfilename)

View File

@@ -113,8 +113,7 @@ return {
local cmd = ('"%s" %s'):format(quick, options)
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,GetPathWithSep(projdir),true,true,nil,nil,
function() ide.debugger.pid = nil end)
return CommandLineRun(cmd,GetPathWithSep(projdir),true,true)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)

View File

@@ -87,7 +87,7 @@ return {
or ('"%s" "%s"'):format(moai, file)
-- CommandLineRun(cmd,wdir,tooutput,nohide,stringcallback,uid,endcallback)
return CommandLineRun(cmd,self:fworkdir(wfilename),true,false,nil,nil,
function() ide.debugger.pid = nil if rundebug then wx.wxRemoveFile(file) end end)
function() if rundebug then wx.wxRemoveFile(file) end end)
end,
fprojdir = function(self,wfilename)
return wfilename:GetPath(wx.wxPATH_GET_VOLUME)

View File

@@ -1125,7 +1125,6 @@ end
function DebuggerStop()
if (debugger.server) then
debugger.server = nil
debugger.pid = nil
SetAllEditorsReadOnly(false)
ShellSupportRemote(nil)
ClearAllCurrentLineMarkers()
@@ -1139,6 +1138,8 @@ function DebuggerStop()
-- no debugger.server, but scratchpad may still be on. Turn it off.
DebuggerScratchpadOff()
end
-- debugger can be stopped after "normal" run; need to reset debugger.pid
debugger.pid = nil
end
function DebuggerMakeFileName(editor, filePath)