scriptcs
scriptcs copied to clipboard
Double Ctrl+C to exit
We should add a "Press Ctrl+C again to exit" confirmation so you don't exit by accident, like Node. We should be able to use the Console.CancelKeyPress event for this. By setting the ConsoleCancelEventArgs.Cancel property to true, you can continue execution.
Cancel, which allows you to determine how to your application should respond to the user pressing Ctrl+C or Ctrl+Break. By default, the Cancel property is false, which causes program execution to terminate when the event handler exits. Changing its property to true specifies that the application should continue to execute.
Anyone up for it? :smile:
I played around with it once but it's a minefield. Not in short because Console.CancelKeyPress goes off on some threadpool thread. But if anyone can get it working, :+1:. Maybe I was just being dumb.
Or we can introduce a seperate set of keys to exit. This will be necessary once this come in (https://github.com/scriptcs/scriptcs/issues/685)
On Sun, May 18, 2014 at 3:44 PM, Adam Ralph [email protected]:
I played around with it once but it's a minefield. Not in short because Console.CancelKeyPress goes off on some threadpool thread. But if anyone can get it working, [image: :+1:]. Maybe I was just being dumb.
— Reply to this email directly or view it on GitHubhttps://github.com/scriptcs/scriptcs/issues/698#issuecomment-43455978 .
For the sake of aligning with Python would Ctrl+Z, or Ctrl+D be a viable candidate?
I personally prefer CTRl + C. Feels more intuitive for most C# devs.
Open to other opinions of course.
@dschenkelman agree here ^C feels best from both *nix side and windows :)
And I think, as far as the console goes, Ctrl+C or Ctrl+Break is our only (?) option...
Question about the method 'Exit' in ScriptCs.Hosting.ScriptConsole.
https://github.com/scriptcs/scriptcs/blob/dev/src/ScriptCs.Hosting/ScriptConsole.cs
Are you folks intending to use that as the means of exiting the application? It looks like you are just wanting to call ResetColor in the places I see you using it. In particular I'm looking at Program.ParseArguments
https://github.com/scriptcs/scriptcs/blob/dev/src/ScriptCs/Program.cs
but, there are other places that I would imagine you do not want to actually exit the application.
I'll take a look