Silent exit of cron and worker with keyboard

This commit is contained in:
Cédric Krier
2024-02-04 20:51:05 +01:00
parent e77255d0c1
commit 02bbbc6549
2 changed files with 10 additions and 4 deletions
+5 -2
View File
@@ -30,5 +30,8 @@ import trytond.cron as cron
from trytond.pool import Pool
with commandline.pidfile(options):
Pool.start()
cron.run(options)
try:
Pool.start()
cron.run(options)
except KeyboardInterrupt:
pass
+5 -2
View File
@@ -32,5 +32,8 @@ from trytond.pool import Pool
# Ensure main module can be safely imported by a new interpreter
if __name__ == '__main__':
with commandline.pidfile(options):
Pool.start()
worker.work(options)
try:
Pool.start()
worker.work(options)
except (KeyboardInterrupt, SystemExit):
pass