99import subprocess
1010import re
1111import time
12+ import os
1213
1314class Handler (BaseHTTPRequestHandler ):
1415 def do_POST (self ):
@@ -25,8 +26,10 @@ def do_POST(self):
2526 prettyCmd = "taco " + cmd
2627 cmd = cmd .replace ("\" " , "" )
2728
28- logFile = "/home/ubuntu/success.log"
29- tacoPath = "/home/ubuntu/taco/build/bin/taco"
29+ homeDir = os .path .expanduser ('~' )
30+ logsDir = homeDir + "/web-tool-logs/"
31+ logFile = logsDir + "/success.log"
32+ tacoPath = "/taco/build/bin/taco"
3033
3134 prefix = "/tmp/" + str (threading .current_thread ().ident ) + "_"
3235 writePath = prefix + "taco_kernel.c"
@@ -47,17 +50,17 @@ def do_POST(self):
4750 response ['assembly-kernel' ] = assemblyKernel
4851 except subprocess .TimeoutExpired :
4952 response ['error' ] = 'Server is unable to process the request in a timely manner'
50- logFile = "/home/ubuntu /timeout.log"
53+ logFile = logsDir + " /timeout.log"
5154 except subprocess .CalledProcessError as e :
5255 search = re .compile (':\n .*\n ' ).search (e .output .decode ())
5356 if search is not None :
5457 response ['error' ] = search .group ()[3 :- 1 ]
5558 else :
5659 response ['error' ] = 'Expression and/or schedule is currently not supported'
57- logFile = "/home/ubuntu /errors.log"
60+ logFile = logsDir + " /errors.log"
5861 except :
5962 response ['error' ] = 'Expression and/or schedule is currently not supported'
60- logFile = "/home/ubuntu /errors.log"
63+ logFile = logsDir + " /errors.log"
6164
6265 ip = "." .join (self .client_address [0 ].split ('.' )[0 :- 2 ]) + ".*.*"
6366 curTime = datetime .now ().isoformat (' ' )
0 commit comments