-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
39 lines (32 loc) · 986 Bytes
/
run.py
File metadata and controls
39 lines (32 loc) · 986 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import subprocess
import sys
from converter import parser
# from parser import parser as raw_parser
try:
while True:
# Function to parse input
def parse_input(s):
return parser.parse(s)
# Example usage
input_string = input("Input formula : ")
ast = parse_input(input_string)
print(ast)
# Example shell command
command = "make clean"
# Run the command
output = subprocess.run(command, shell=True, capture_output=True, text=True)
except EOFError:
command = "rm -rf __pycache__"
output = subprocess.run(command, shell=True, capture_output=True, text=True)
sys.exit(1)
#
# # Check if the command executed successfully
# if output.returncode == 0:
# print("Command executed successfully!")
# # Print the output
# print("Output:")
# print(output.stdout)
# else:
# print("Error executing command:")
# # Print the error message
# print(output.stderr)