Sublime Forum

Running C++ script won't stop after quit

#1

I built and ran a C++ code with an infinite loop inside Sublime Text 3. I ran the script at least 6 times and tried to stop it each time by closing Sublime using the cmd + Q shortcut. Once I noticed input lag inside Sublime, I checked System Monitor, and noticed 6 processes, each one with the name of my script, so I had to stop those from there. Is this the way Sublime handles compile and run or is this a bug? Wouldn’t it be better if the script was stopped when you quit sublime?

Using MacBook Pro
Processor 2.4 GHz Intel Core i5
Memory 16 GB 1333 MHz DDR3
Software OS X 10.9.2 (13C64)
Sublime Text 3 Build 3059

0 Likes

#2

I have had this issue before as well, it seems that SublimeText uses an external compiler to build and run your script as a separate process, and terminates it upon the end of the programs logic.

If there is an infinite loop present, the logic never comes to an end and it eats up your RAM and CPU usage. Closing SublimeText doesn’t solve this issue, because the script is running as its’ own process, so you have to use TaskManager or something similar to force end it. As far as I can tell, there isn’t a way around this other then to make sure that your loops have a proper increment or break in them to keep this from happening.

Debugging is not SublimeText’s forte, Just keep TaskManager open while debugging or maybe consider using Visual Studio or another Debugging platform if you are trying to fix a complicated problem, or just be more mindful of your programs logic.

Sorry I couldn’t be of more help. But maybe there is a package that you can install to help facilitate debugging.
Check it out with PackageControl: https://sublime.wbond.net/installation

0 Likes