-run command line argument when script is already running

Is there any way to call Linqpad9.exe scriptPath -run so that it automatically starts the script if it is not already running, but just switches to the script if it is already running?

At the moment the script is restarted.

Best Answer

  • I thought this was how it already behaved.

    It should never stop and re-start a script the second time you call LINQPad9.exe scriptPath -run. If the script already finished running, though, it will run it again.

Answers

  • You are (of course) correct.

    I have solved my issue by adding a Util.KeepRunning(); command to the script.

    The script was creating some linqpad controls and responding to user input. I don't know how to describe the state of such scripts. I find it counterintuitive that I can run a C# code in a script that is not 'running'. So I tend to think of such scripts as still running until they are unloaded and the Util.KeepRunning() command is more like a request to keep LinqPad in control of the script or to stop Linqpad from unloading the script until it is told to.