Skip to content

Commit bbe02ac

Browse files
committed
Start ! to allow running of OS commands
1 parent fbfcb39 commit bbe02ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mathicsscript/__main__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,12 @@ def main(
333333

334334
evaluation = Evaluation(shell.definitions, output=TerminalOutput(shell))
335335
query, source_code = evaluation.parse_feeder_returning_code(shell)
336+
if len(source_code) and source_code[0] == "!":
337+
os.system(source_code[1:])
338+
# Should we test exit code for adding to history?
339+
GNU_readline.add_history(source_code.rstrip())
340+
continue
341+
336342
if shell.using_readline and hasattr(GNU_readline, "remove_history_item"):
337343
current_pos = GNU_readline.get_current_history_length()
338344
for pos in range(last_pos, current_pos - 1):

0 commit comments

Comments
 (0)