diff --git a/console/application/cl_client.py b/console/application/cl_client.py index 643a865..0eb1a45 100644 --- a/console/application/cl_client.py +++ b/console/application/cl_client.py @@ -279,10 +279,9 @@ def https_server(client, args, unknown_args, url, clVarsCore, wait_thread): wait_thread.stop() return 0 -def main(): +def main(wait_thread): parser = parse() args, unknown_args = parser.parse_known_args() - wait_thread = StoppableThread() wait_thread.start() if not args.method and args.help: wait_thread.stop() diff --git a/scripts/cl-console b/scripts/cl-console index 75b92b4..c53fdfc 100755 --- a/scripts/cl-console +++ b/scripts/cl-console @@ -16,7 +16,7 @@ # limitations under the License. import sys -from calculate.console.application.cl_client import main +from calculate.console.application.cl_client import main, StoppableThread from calculate.console.application.function import _print reload(sys) sys.setdefaultencoding("utf-8") @@ -28,8 +28,10 @@ setLocalTranslate('calculate_console',sys.modules[__name__]) if __name__=='__main__': __builtin__.__dict__['_print'] = _print try: - sys.exit(main()) + wait_thread = StoppableThread() + sys.exit(main(wait_thread)) except KeyboardInterrupt: + wait_thread.stop() red = '\033[31m * \033[0m' print '\n'+red+_('Interrupted by user') sys.exit(1) \ No newline at end of file