From: José Fonseca Date: Thu, 20 Oct 2011 14:12:10 +0000 (+0200) Subject: retracediff: More helpful error message when glretrace is not found. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=203030396513aa70b835972c53a32b717cf7433c;p=apitrace retracediff: More helpful error message when glretrace is not found. --- diff --git a/scripts/retracediff.py b/scripts/retracediff.py index 0b6a3b0..bed216c 100755 --- a/scripts/retracediff.py +++ b/scripts/retracediff.py @@ -54,23 +54,28 @@ class Setup: self.args = args self.env = env - def retrace(self): + def _retrace(self, args): cmd = [ options.retrace, + ] + args + self.args + try: + return subprocess.Popen(cmd, env=self.env, stdout=subprocess.PIPE, stderr=NULL) + except OSError, ex: + sys.stderr.write('error: failed to execute %s: %s\n' % (cmd[0], ex.strerror)) + sys.exit(1) + + def retrace(self): + return self._retrace([ '-s', '-', '-S', options.snapshot_frequency, - ] + self.args - p = subprocess.Popen(cmd, env=self.env, stdout=subprocess.PIPE, stderr=NULL) - return p + ]) def dump_state(self, call_no): '''Get the state dump at the specified call no.''' - cmd = [ - options.retrace, + p = self._retrace([ '-D', str(call_no), - ] + self.args - p = subprocess.Popen(cmd, env=self.env, stdout=subprocess.PIPE, stderr=NULL) + ]) state = jsondiff.load(p.stdout) p.wait() return state.get('parameters', {})