Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2008-08-10 08:28:19 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2008-08-10 08:28:19 (GMT)
commit9f4ab84437fc4e05e164c0e15d00326e7d3c1301 (patch)
treeb63e6089661b66f2a90ad8f03b9a7220fe7220ea /scripts
parent84d4dac9285811aafeee8132e17a0c61b4a47d6d (diff)
Cleanup xvfb on exit.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/check.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/scripts/check.py b/scripts/check.py
index c8628be..79396cf 100644
--- a/scripts/check.py
+++ b/scripts/check.py
@@ -2,6 +2,7 @@ import os
import sys
from optparse import make_option
import random
+import signal
import subprocess
from jhbuild.commands import Command, register_command
@@ -30,13 +31,16 @@ class cmd_check(Command):
port = ':%d' % random.randrange(100, 1000)
try:
- subprocess.Popen(['Xvfb', '-ac', port],
- stdout=open(os.devnull, "w"),
- stderr=subprocess.STDOUT)
+ p = subprocess.Popen(['Xvfb', '-ac', port],
+ stdout=open(os.devnull, "w"),
+ stderr=subprocess.STDOUT)
os.environ['DISPLAY'] = port
+ return p.pid
except OSError:
print 'Cannot execute xfvb, will use the default display.'
+ return None
+
def lint(self, module):
subprocess.call(['pylint', module, '--rcfile=%s' % pylintrc_path])
@@ -68,11 +72,13 @@ class cmd_check(Command):
print 'Done.'
def run(self, config, options, args):
- self.start_xvfb(options.xvfb_port)
+ xvfb_pid = self.start_xvfb(options.xvfb_port)
- if options.type == 'pylint':
- self.check_pylint(config)
- else:
- return False
+ try:
+ if options.type == 'pylint':
+ self.check_pylint(config)
+ finally:
+ if xvfb_pid:
+ os.kill(xvfb_pid, signal.SIGTERM)
register_command(cmd_check)