Commit 0ce1754c authored by Sean Leavey's avatar Sean Leavey
Browse files

Merge debug commands for kat and py files

parent 93d09c20
......@@ -728,22 +728,23 @@ def debug(ctx):
def run_debug(
ctx, input_file, plot, trace, legacy,
):
"""Run a Finesse script with Python fault handler enabled."""
import faulthandler
faulthandler.enable()
ctx.forward(run)
"""Run a Finesse script with Python fault handler enabled.
@debug.command(name="run-py")
@input_file_argument
@click.pass_context
def run_py(ctx, input_file):
"""Run a Python file with Python fault handler enabled."""
If the file extension is 'py', it is interpreted as Python code; otherwise it is parsed assuming
it to be kat script.
"""
import os
import faulthandler
click.secho("Enabling Python fault handler", fg="yellow")
faulthandler.enable()
exec(input_file.read())
root, ext = os.path.splitext(input_file.name)
if ext.casefold() == ".py":
exec(input_file.read())
else:
# Forward arguments to normal "run" command.
ctx.forward(run)
@debug.command()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment