User forums > Using Code::Blocks
How does Run abort work
tigerbeard:
In the CodeBlocks compiler toolbar is a red button with a white cross. If one starts the current project with the green Run button, is stopped when that red button is pressed.
Does anyone know what actually happens when I press that button?
using CB16.1/Win7
BlueHazzard:
C::b is open source so: look into the code ;)
--- Code: ---int CompilerGCC::KillProcess()
{
ResetBuildState();
m_RunAfterCompile = false;
if (!IsProcessRunning())
return 0;
if (!m_CommandQueue.LastCommandWasRun())
LogMessage(_("Aborting build..."), cltInfo, ltMessages);
wxKillError ret = wxKILL_OK;
m_CommandQueue.Clear();
for (size_t i = 0; i < m_CompilerProcessList.size(); ++i)
{
if (!m_CompilerProcessList.at(i).pProcess)
continue;
#if defined(WIN32) && defined(ENABLE_SIGTERM)
::GenerateConsoleCtrlEvent(0, m_CompilerProcessList.at(i).PID);
#endif
// Close input pipe
m_CompilerProcessList.at(i).pProcess->CloseOutput();
((PipedProcess*) m_CompilerProcessList.at(i).pProcess)->ForfeitStreams();
ret = wxProcess::Kill(m_CompilerProcessList.at(i).PID, wxSIGTERM);
if (!platform::windows)
{
if (ret != wxKILL_OK)
{
// No need to tell the user about the errors - just keep him waiting.
Manager::Get()->GetLogManager()->Log(F(_("Aborting process %d ..."), i), m_PageIndex);
}
else switch (ret)
{
case wxKILL_OK:
Manager::Get()->GetLogManager()->Log(_("Process aborted (killed)."), m_PageIndex);
// case wxKILL_ACCESS_DENIED: cbMessageBox(_("Access denied")); break;
// case wxKILL_NO_PROCESS: cbMessageBox(_("No process")); break;
// case wxKILL_BAD_SIGNAL: cbMessageBox(_("Bad signal")); break;
// case wxKILL_ERROR: cbMessageBox(_("Unspecified error")); break;
case wxKILL_ACCESS_DENIED: // fall-through
case wxKILL_NO_PROCESS: // fall-through
case wxKILL_BAD_SIGNAL: // fall-through
case wxKILL_ERROR: // fall-through
default: break;
}
}
}
ProjectManager *projectManager = Manager::Get()->GetProjectManager();
if (projectManager->GetIsRunning() == this)
projectManager->SetIsRunning(NULL);
return ret;
}
--- End code ---
oBFusCATed:
I don't think this is the correct function:)
BlueHazzard:
--- Quote from: tigerbeard on March 31, 2016, 01:18:17 am ---Does anyone know what actually happens when I press that button?
--- End quote ---
well i didn't read the title...
tigerbeard:
--- Code: ---ret = wxProcess::Kill(m_CompilerProcessList.at(i).PID, wxSIGTERM);
--- End code ---
Wouldn't that be the same than using taskkill PID on the console? This produces a different result that that button, so the button must do sth else.
--- Quote from: BlueHazzard on April 02, 2016, 03:25:55 pm ---C::b is open source so: look into the code ;)
--- End quote ---
Forgot to say that I tried that. Unfortunately CB does not compile so I can't use a breakpoint to find out where I need to look or what I need to search for. Unfortunatley I did not yet understand the structure of the source, though. Maybe a hint about which class handles that button would help.
Navigation
[0] Message Index
[#] Next page
Go to full version