Gargravarr
Gargravarr

Reputation: 675

Powershell ISE - Ctrl-C on empty line kills executing script?

I kicked off a long-running script in ISE earlier, and started work on a second while it was running, keeping an eye on its progress in the console panel. I was copying a function call to another part of the second script when I typo'd and pushed Ctrl-C rather than Ctrl-V. Immediately, the executing script exited. It seems ISE interpretted it as a SIGTERM to the running script, even though I didn't have the console panel highlighted.
I can't see any options to disable this, but if this is intended behaviour then I find it unacceptable. I need to find a way to switch this off as I've lost about an hour's worth of work (the script has to run from start to end) through one accidental click that should have done nothing. Does anyone know if this is intended behaviour, or have I run into something else?

Upvotes: 0

Views: 451

Answers (1)

briantist
briantist

Reputation: 47792

Workaround: File > New PowerShell Tab

That will create a new environment, which has the added benefit of letting you run the second script independently of the first.

But you might consider that ISE is better suited for development and testing of scripts, not so much for long running "production" processes while you also developing other scripts. I mean you can use it for that, but it's probably considered an edge use case.

You mentioned:

Creating the new tab does work, but it means I can't see the currently-executing script at a glance.

In that case, you can open a new console host (powershell.exe) and run your script outside of ISE (while continuing to develop it and save it in ISE). But it may still be hard to see unless you can move it to another monitor. Thoug hin that case, you could just open up a whole new ISE instance as well!

Upvotes: 3

Related Questions