In the Designer’s Script Console, there seems to be no way to kill a script running in the Multiline Buffer. I ran into this issue when I accidentally created an infinite loop in some code I was testing, and was unable to kill the execution of this script without completely restarting the Designer.
This is something we would love to implement, but it’s unfortunately essentially impossible. Because we’re just executing the code you’ve written, it’s extremely easy to write an indefinite loop - and identifying that your code is going to loop indefinitely is the halting problem.
There’s also no mechanism in Java (or most languages) to stop an infinitely running thread once it’s going - even the deprecated
stop() method on the base Thread class requires the cooperation of the running thread…which obviously it won’t have, because it’s busy running your infinite loop.
I see, gotcha.
Of course I wouldn’t expect the console to detect an infinite loop, but thought it could be possible to implement a stop-button type thing. Didn’t realize there were limitations to doing that.
So, turns out, I lied, and another developer managed to figure this out
Tomorrow’s nightly build should have an interrupt available in the script console.
Eyy, nice! Thanks a bunch!
When will this be available in Ignition 7.9? Thanks!
Almost certainly not. It uses some Jython internals that are fundamentally different between 2.7 (what’s included in 8.0) and 2.5, which 7.9 is still using. Upgrading Jython in the 7.9 branch is high risk, low reward for an LTS branch.