<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -25,7 +25,7 @@ scm_cmds = { 'git':
                   {   
                     'reset':[&quot;git&quot;, &quot;reset&quot;, &quot;--hard&quot;], 
                     'rev':[&quot;git&quot;, &quot;rev-parse&quot;, &quot;HEAD&quot;] 
-                  }
+                  },
                 'svn': 
                   {   
                     'reset':[&quot;svn&quot;, &quot;update&quot;], 
@@ -56,8 +56,11 @@ def exec_ci_cmd(c):
   
 @route('/build')
 def build(web):
-  ret, data = cmd(scm_cmds[repo_type]['rev'], repo_path);
-  b = Build(date=datetime.datetime.now().strftime(&quot;%b%d %H:%M&quot;), finished=False, rev=data)
+
+  kill_zombies(); #hack
+
+  data, ret = cmd(scm_cmds[repo_type]['rev'], repo_path);
+  b = Build(date=datetime.datetime.now().strftime(&quot;%b%d %H:%M&quot;), finished=False, rev=data[:6])
   b.save();
   # i was using a thread before but sqlite doesn't support access to same object from different threads
   pid = os.fork();
@@ -77,13 +80,20 @@ def build(web):
       exec_ci_cmd(&quot;build_pass&quot;);
     else:
       exec_ci_cmd(&quot;build_failed&quot;);
-    sys.exit()
-  else:
-    return &quot;scheduled!&quot;
+    os._exit(0);
+  return &quot;scheduled!&quot;
  
+def kill_zombies():
+  try:
+    while 1:
+            os.waitpid(0, 0);
+  except:
+    pass
 
 @route('/')
 def index(web):
+  # terminate pending forked process
+  kill_zombies();
   builds = find(Build).order_by(Build.id.desc()).limit(10).all();
   template(&quot;index.html&quot;, { 'builds': builds, 'project_path': repo_path })
   </diff>
      <filename>run.py</filename>
    </modified>
    <modified>
      <diff>@@ -55,7 +55,7 @@ background-color:#F8F8F8; border:1px solid #DEDEDE; padding: 20px;}
       {% for b in builds%}
           &lt;li&gt;&lt;span class=&quot;date&quot;&gt;{{b.date}}&lt;/span&gt; 
           {% if b.finished %}
-            rev: {% b.rev %}
+            rev: {{ b.rev }}
             {% if b.result == 0 %}
             &lt;span class=&quot;ok&quot;&gt;PASS&lt;/span&gt;
             {% else %}</diff>
      <filename>templates/index.html</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>c71fd44d93140514efb1d526771e79d05a8f4871</id>
    </parent>
  </parents>
  <author>
    <name>javi</name>
    <email>globalx@localhost.(none)</email>
  </author>
  <url>http://github.com/javisantana/cipy/commit/aaa7ef0b6cca5cdb7c74e701ad42d42427af6868</url>
  <id>aaa7ef0b6cca5cdb7c74e701ad42d42427af6868</id>
  <committed-date>2009-10-21T07:55:11-07:00</committed-date>
  <authored-date>2009-10-21T07:55:11-07:00</authored-date>
  <message>solved problems with process management (killing zombies)</message>
  <tree>7ff3242922fcf3d5e2f9a9dd8f38b7f9a35b4ec5</tree>
  <committer>
    <name>javi</name>
    <email>globalx@localhost.(none)</email>
  </committer>
</commit>
