Esempio n. 1
0
        public static void StopBuild()
        {
            Data.sCmd = "";
            if (Data.bNowBuilding)
            {
                fDisableBuild();
                Output.Trace("\f4C--Stop Build--");
                SysAPI.KillProcessAndChildren(Data.MainProcess.Id);
                //fClearData();

                //CppCompiler.safeInstanceCount = 0;
            }
        }
Esempio n. 2
0
        static public void fQuit(bool _bForceQuitConsole = false)
        {
            //      MessageBox.Show("QUIIIIIIIIIIIIIIII!!!!!!!!!!");

            /*
             * if (oLaunchProject.oCurLaunch != null && oLaunchProject.oCurLaunch.sExeName == "gdb") {
             *  oLaunchProject.oCurLaunch.fSend("set confirm off");
             *  oLaunchProject.oCurLaunch.fSend("quit");
             * }*/
            //fSaveConsolePosition();

            if (!bQuitSavedCfg)
            {
                bQuitSavedCfg = true;
                Data.oConfigMng.SaveConfig();                     //save screenn coordinate
            }

            //	MessageBox.Show("QUIIIIIIIIIIIIIIII!!!!!!!!!! ",  "ass", MessageBoxButtons.OK, MessageBoxIcon.Warning);
//MessageBox.Show("********QUIIIIIIIIIIIIIIII!!!!!!!!!! ",  "aaa", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            Base.bAlive   = false;
            Data.bModeIDE = false;
            Build.StopBuild();
            Thread.CurrentThread.Join(1);


/*
 *                if(oMainForm != null && !oMainForm.IsDisposed) {
 *                              oMainForm.AppQuit();
 *                      }*/

            SysAPI.KillProcessAndChildren(Data.MainProcess.Id);
            //	PipeInput.fTestIdeClosed();

/*
 *           if(oMainForm != null) {
 *              oMainForm.AppQuit();
 *          }*/
            if (_bForceQuitConsole)
            {
                //   Thread.Sleep(1000); //Last chance for other thread
                Thread.Sleep(90);    //Last chance for other thread
                Environment.Exit(1);
            }
        }
Esempio n. 3
0
        internal void fEnd()
        {
            //  Output.Trace("\f18--Try to Close--");
            bStopAll = true;

            if (dExit != null)
            {
                dExit(this);
            }
            ;
            SysAPI.KillProcessAndChildren(Data.MainProcess.Id);   //TODO more gentle with -- SEND WM_CLOSE -- ?


            while (!ExeProcess.HasExited && Base.bAlive)
            {
                Thread.CurrentThread.Join(1);
            }


            return;


///////////////////////////////////////////////

            if (bSanitize)
            {
                List <Process> children = GetChildProcesses(ExeProcess);
                foreach (Process _procChild in children)
                {
                    // Debug.fTrace("---------------ID: " + _procChild.Id.ToString());

                    //      Debug.fTrace("sExePath: " +sExePath);


                    /* //Try to nurge, (not the besst way)
                     * ProcessStartInfo processStartInfo = new ProcessStartInfo(sExePath, " -nudge " + _procChild.Id.ToString());
                     * processStartInfo.UseShellExecute = false;
                     *
                     * ExeProcess.StartInfo = processStartInfo;
                     * processStartInfo.WorkingDirectory = Path.GetDirectoryName(sWorkPath); //_sExePath PathHelper.ModulesDir + "/Emscripten_x64/python/2.7.5.3_64bit/"; //TODO
                     * ExeProcess.Start();
                     */

                    try{
                        if (_procChild.CloseMainWindow())   //Todo another process  // SEND WM_CLOSE
                        //	Debug.fTrace("");
                        {
                            Output.Trace("\f4C-- SEND WM_CLOSE --");
                            //   _procChild.WaitForExit(1000); //if hang
                        }
                        else
                        {
                            if (!_procChild.HasExited)
                            {
                                Output.Trace("\f4C-- KILL --");
                                _procChild.Kill();
                                if (dExit != null)
                                {
                                    dExit(this);
                                }
                                ;
                            }
                        }
                        // _procChild.Close();
                    }catch (Exception Ex) { }


                    // .CloseMainWindow();


                    //   _procChild.WaitForExit(1000); //if hang


                    //      _procChild.WaitForExit(1000); //if hang
                    //    _procChild.Kill();
                    //  _procChild.CloseMainWindow();
                    //   _procChild.Close();
                    //  ExeProcess.Clos();
                    //  _procChild.Kill();
                }
            }
            else
            {
                List <Process> children = GetChildProcesses(ExeProcess);
                foreach (Process _procChild in children)  //TODO recursive of child process?

                {
                    try{
                        //Output.TraceError("Try to kill");

                        /*
                         * if (ExeProcess.MainWindowHandle == IntPtr.Zero) {
                         *
                         * // ExeProcess.CloseMainWindow();
                         *     ExeProcess.Kill();
                         *     ExeProcess.Close();
                         * }else {
                         */
                        if (!_procChild.HasExited)
                        {
                            //  Output.TraceError("not HasExited");

                            try{ if (_procChild.CloseMainWindow()) //Todo another process  // SEND WM_CLOSE
                                 {
                                     _procChild.WaitForExit(1000); //if hang
                                 }
                            }catch (Exception Ex) { }


                            if (!_procChild.HasExited)
                            {
                                // Output.TraceError("alwaus not HasExited");
                                //  Output.Trace("\f4C-- KILL --");
                                _procChild.Kill();
                                if (dExit != null)
                                {
                                    dExit(this);
                                }
                                ;
                            }
                        }



                        //ExeProcess.Close();
                        // }
                    }catch (Exception Ex) { }
                }
            }

            while (!ExeProcess.HasExited && Base.bAlive)
            {
                Thread.CurrentThread.Join(1);
            }
            //             Output.Trace("\f18-Finish-");
        }