Browse Source

Update evhttp-sharp with mono fixes

Hamilton Turner 10 years ago
parent
commit
364904eccc
2 changed files with 21 additions and 13 deletions
  1. 8 0
      frameworks/C#/evhttp-sharp/bash_profile.sh
  2. 13 13
      frameworks/C#/evhttp-sharp/setup.py

+ 8 - 0
frameworks/C#/evhttp-sharp/bash_profile.sh

@@ -0,0 +1,8 @@
+#!/bin/bash
+
+export MONO_ROOT=${IROOT}/mono-3.6.0-install
+
+export PATH="$MONO_ROOT/bin:$PATH"
+
+# Needed to find Mono's shared libraries
+export LD_LIBRARY_PATH="$MONO_ROOT/lib"

+ 13 - 13
frameworks/C#/evhttp-sharp/setup.py

@@ -3,26 +3,26 @@ import sys
 import setup_util
 import os
 
-
 def start(args, logfile, errfile):
   if os.name == 'nt':
     return 1
   
-  app = args.troot + "/src"
-
-  try:
-    # build
-    subprocess.check_call("rm -rf bin obj", shell=True, cwd=app, stdout=logfile, stderr=errfile)
-    subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd=app, stdout=logfile, stderr=errfile)
-    os.environ['MONO_GC_PARAMS']="nursery-size=64m"
-    subprocess.Popen("mono -O=all bin/Release/EvHttpSharpBenchmark.exe 127.0.0.1 8085 " + str(args.max_threads) + " &", shell=True, cwd=app, stdout=logfile, stderr=errfile)
-    return 0
-  except subprocess.CalledProcessError:
-    return 1
+  # build
+  subprocess.check_call("rm -rf bin obj", shell=True, cwd="evhttp-sharp", stdout=logfile, stderr=errfile)
+  subprocess.check_call("xbuild /p:Configuration=Release", shell=True, cwd="evhttp-sharp/src", stdout=logfile, stderr=errfile)
+  os.environ['MONO_GC_PARAMS']="nursery-size=64m"
+  subprocess.Popen("mono -O=all $TROOT/src/bin/Release/EvHttpSharpBenchmark.exe 127.0.0.1 8085 " + str(args.max_threads), shell=True, cwd="evhttp-sharp", stdout=logfile, stderr=errfile)
 
 def stop(logfile, errfile):
   if os.name == 'nt':
     return 0
   
-  subprocess.check_call("pkill -9 mono", shell=True)
+  # stop mono
+  p = subprocess.Popen(['ps', 'aux'], stdout=subprocess.PIPE)
+  out, err = p.communicate()
+  for line in out.splitlines():
+    if 'mono' in line and not 'run-ci' in line and not 'run-tests' in line:
+      pid = int(line.split(None, 2)[1])
+      os.kill(pid, 15)
+
   return 0