Browse Source

Let FrameworkTest handle exceptions

Hamilton Turner 10 years ago
parent
commit
7eb63d1998
1 changed files with 24 additions and 19 deletions
  1. 24 19
      frameworks/C#/aspnet/setup_nginx.py

+ 24 - 19
frameworks/C#/aspnet/setup_nginx.py

@@ -7,33 +7,38 @@ def start(args, logfile, errfile):
   if os.name == 'nt':
     return 1
   
+
   setup_util.replace_text("aspnet/src/Web.config", "localhost", args.database_host)
 
-  try:
-    # build
-    subprocess.check_call("rm -rf bin obj", shell=True, cwd="aspnet", stderr=errfile, stdout=logfile)
-    subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd="aspnet/src", stderr=errfile, stdout=logfile)
-    subprocess.check_call("sudo chown -R $USER:$USER $MONO_ROOT", shell=True, stderr=errfile, stdout=logfile)
-    
-    # nginx
-    workers = 'worker_processes ' + str(args.max_threads) + ';'
-    subprocess.check_call('echo "upstream mono {\n' + ';\n'.join('\tserver 127.0.0.1:' + str(port) for port in range(9001, 9001 + args.max_threads)) + ';\n}" > $TROOT/nginx.upstream.conf', shell=True, stderr=errfile, stdout=logfile);
-    subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -g "' + workers + '"', shell=True, stderr=errfile, stdout=logfile)
-    
-    # fastcgi
-    for port in range(9001, 9001 + args.max_threads):
-      # /usr/local/bin/fastcgi-mono-server4
-      subprocess.Popen("MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 /applications=/:. /socket=tcp:127.0.0.1:" + str(port) + " &", shell=True, cwd="aspnet", stderr=errfile, stdout=logfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
+  # build
+  subprocess.check_call("rm -rf bin obj", shell=True, cwd="aspnet", stderr=errfile, stdout=logfile)
+  subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd="aspnet/src", stderr=errfile, stdout=logfile)
+  subprocess.check_call("sudo chown -R $USER:$USER $MONO_ROOT", shell=True, stderr=errfile, stdout=logfile)
+  
+  # nginx
+  workers = 'worker_processes ' + str(args.max_threads) + ';'
+  logfile.write("Setting up workers as %s\n\n" % workers)
+  errfile.write("Does this even work?")
+  print "Hello there?"
+  sys.stdout.write("Testing stdout write")
+  subprocess.check_call("echo Hello there", shell=True, stderr=errfile, stdout=logfile);
+  command = 'echo "upstream mono {\n' + ';\n'.join('\tserver 127.0.0.1:' + str(port) for port in range(9001, 9001 + args.max_threads)) + ';\n}" > $TROOT/nginx.upstream.conf'
+  logfile.write("Using command %s" % command)
+  subprocess.check_call(command, shell=True, stderr=errfile, stdout=logfile);
+  subprocess.check_call('sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -g "' + workers + '"', shell=True, stderr=errfile, stdout=logfile)
+  
+  # fastcgi
+  for port in range(9001, 9001 + args.max_threads):
+    # /usr/local/bin/fastcgi-mono-server4
+    subprocess.Popen("MONO_OPTIONS=--gc=sgen fastcgi-mono-server4 /applications=/:. /socket=tcp:127.0.0.1:" + str(port) + " &", shell=True, cwd="aspnet", stderr=errfile, stdout=logfile)
+  return 0
 
 def stop(logfile, errfile):
   if os.name == 'nt':
     return 0
   
   subprocess.check_call("sudo /usr/local/nginx/sbin/nginx -c $TROOT/nginx.conf -s stop", shell=True, stderr=errfile, stdout=logfile)
-  subprocess.check_call("rm -f $TROOT/nginx.upstream.conf", shell=True, stderr=errfile, stdout=logfile)
+  # subprocess.check_call("rm -f $TROOT/nginx.upstream.conf", shell=True, stderr=errfile, stdout=logfile)
   #
   # stop mono
   #