Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mathicsscript/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ def fmt_fun(query: Any) -> Any:

except ShellEscapeException as e:
source_code = e.line
if not settings.ENABLE_SYSTEM_COMMANDS:
shell.errmsg("System commands are disabled in sandboxed mode.")
continue
if len(source_code) and source_code[1] == "!":
try:
print(open(source_code[2:], "r").read())
Expand Down
3 changes: 3 additions & 0 deletions mathicsscript/interrupt.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def inspect_eval_loop(evaluation: Evaluation):
query, source_code = evaluation.parse_feeder_returning_code(shell)
# show_echo(source_code, evaluation)
if len(source_code) and source_code[0] == "!" and shell is not None:
if not settings.ENABLE_SYSTEM_COMMANDS:
print("System commands are disabled in sandboxed mode.")
continue
subprocess.run(source_code[1:], shell=True)
if shell.definitions is not None:
shell.definitions.increment_line_no(1)
Expand Down