Skip to content

Commit

Permalink
add an option to not print stack traces on ctrl+c.
Browse files Browse the repository at this point in the history
  • Loading branch information
AUTOMATIC1111 committed Oct 15, 2023
1 parent d425550 commit 0d65d0e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/initialize_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,14 @@ def dumpstacks():

def configure_sigint_handler():
# make the program just exit at ctrl+c without waiting for anything

from modules import shared

def sigint_handler(sig, frame):
print(f'Interrupted with signal {sig} in {frame}')

dumpstacks()
if shared.opts.dump_stacks_on_signal:
dumpstacks()

os._exit(0)

Expand Down
1 change: 1 addition & 0 deletions modules/shared_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"list_hidden_files": OptionInfo(True, "Load models/files in hidden directories").info("directory is hidden if its name starts with \".\""),
"disable_mmap_load_safetensors": OptionInfo(False, "Disable memmapping for loading .safetensors files.").info("fixes very slow loading speed in some cases"),
"hide_ldm_prints": OptionInfo(True, "Prevent Stability-AI's ldm/sgm modules from printing noise to console."),
"dump_stacks_on_signal": OptionInfo(False, "Print stack traces before exiting the program with ctrl+c."),
}))

options_templates.update(options_section(('API', "API"), {
Expand Down

0 comments on commit 0d65d0e

Please sign in to comment.