I'm loving doit so far, it's great for automating what otherwise would be a gnarly batch file or set of batch files. So thanks everyone!
That said, I do use doit to launch a flask webserver, that can only be terminated via CTRL-C. In doing so however any output I may have gets ran off the screen in showing the traceback from the KeyboardInterrupt:
INFO:werkzeug: * Debugger PIN: 320-533-594
INFO:werkzeug: * Running on
http://127.0.0.1:5000/ (Press CTRL+C to quit)
The process cannot access the file because it is being used by another process.
Traceback (most recent call last):
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "D:\dev\personal\tensorflask\venv\Scripts\doit.exe\__main__.py", line 7, in <module>
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\__main__.py", line 8, in main
sys.exit(DoitMain().run(sys.argv[1:]))
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\doit_cmd.py", line 295, in run
return command.parse_execute(args)
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\cmd_base.py", line 151, in parse_execute
return self.execute(params, args)
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\cmd_base.py", line 605, in execute
return self._execute(**exec_params)
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\cmd_run.py", line 265, in _execute
return runner.run_all(self.control.task_dispatcher())
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\runner.py", line 255, in run_all
self.run_tasks(task_dispatcher)
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\runner.py", line 221, in run_tasks
catched_excp = self.execute_task(node.task)
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\runner.py", line 176, in execute_task
return task.execute(self.stream)
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\task.py", line 466, in execute
action_return = action.execute(task_stdout, task_stderr)
File "D:\dev\personal\tensorflask\venv\lib\site-packages\doit\action.py", line 232, in execute
t_out.join()
File "C:\Python310\lib\threading.py", line 1089, in join
self._wait_for_tstate_lock()
File "C:\Python310\lib\threading.py", line 1109, in _wait_for_tstate_lock
if lock.acquire(block, timeout):
KeyboardInterrupt
Anyhow: I'm happy to implement this and submit a PR: but I'd love it if KeyboardInterrupt was just silently handled, probably returning a non-zero error code in case doit.py is used as part of a script. Does this sound reasonable?