Skip to content

Commit

Permalink
no need to redirect stdout and stdin when loading a module
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Aug 22, 2024
1 parent 7da8bf3 commit d7b5ab0
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions py4web/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,19 +1423,7 @@ def clear_modules():
del Reloader.MODULES[app_name]
clear_modules()

load_module_message = None
buf_out = io.StringIO()
buf_err = buf_out
with redirect_stdout(buf_out), redirect_stderr(buf_err):
module = load_module(module_name, init)
load_module_message = buf_out.getvalue()
buf_out.close()
buf_out = sys.stdout
buf_err = sys.stderr

if load_module_message:
click.secho(f"\x1b[A output {app_name} ", fg="yellow")
click.echo(load_module_message)
module = load_module(module_name, init)

click.secho(f"\x1b[A[X] loaded {app_name} ", fg="green")
Reloader.MODULES[app_name] = module
Expand Down

0 comments on commit d7b5ab0

Please sign in to comment.