-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_launcher.py
More file actions
45 lines (36 loc) · 1.39 KB
/
python_launcher.py
File metadata and controls
45 lines (36 loc) · 1.39 KB
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
40
41
42
43
44
45
import subprocess
def run_cpp(file):
exe = file.replace('.cpp', '')
subprocess.run(['g++', f'server-cpp/{file}', '-lcrypto', '-o', f'server-cpp/{exe}'])
result = subprocess.run([f'./server-cpp/{exe}'], capture_output=True, text=True)
return result.stdout.strip()
def run_php(file):
result = subprocess.run(['php', f'api-php/{file}'], capture_output=True, text=True)
return result.stdout.strip()
def run_java(file):
class_name = file.replace('.java', '')
subprocess.run(['javac', f'logger-java/{file}'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = subprocess.run(['java', '-cp', 'logger-java', class_name], capture_output=True, text=True)
return result.stdout.strip()
def run_js(file):
result = subprocess.run(['node', f'blockchain-js/{file}'], capture_output=True, text=True)
return result.stdout.strip()
def main():
print("=== Running C++ programs ===")
for f in ['Hasher.cpp', 'Hasher2.cpp']:
print(run_cpp(f))
print()
print("=== Running PHP scripts ===")
for f in ['send.php', 'notify.php']:
print(run_php(f))
print()
print("=== Running Java programs ===")
for f in ['Logger.java', 'Notifier.java']:
print(run_java(f))
print()
print("=== Running JS scripts ===")
for f in ['blockchain.js']:
print(run_js(f))
print()
if __name__ == "__main__":
main()