提交 e439247d 编写于 作者: L Lukáš Doktor

Merge pull request #765 from lmr/more-helpful-subprocess-msg-v2

[V2] Fix unhelpful message when calling process/GDB APIs
......@@ -339,11 +339,19 @@ class GDB(object):
args += self.REQUIRED_ARGS
args += extra_args
self.process = subprocess.Popen(args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
try:
self.process = subprocess.Popen(args,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
except OSError, details:
if details.errno == 2:
exc = OSError("File '%s' not found" % args[0])
exc.errno = 2
raise exc
else:
raise
fcntl.fcntl(self.process.stdout.fileno(),
fcntl.F_SETFL, os.O_NONBLOCK)
......@@ -649,11 +657,19 @@ class GDBServer(object):
_, self.stderr_path = tempfile.mkstemp(prefix=prefix + 'stderr_')
self.stderr = open(self.stderr_path, 'w')
self.process = subprocess.Popen(args,
stdin=subprocess.PIPE,
stdout=self.stdout,
stderr=self.stderr,
close_fds=True)
try:
self.process = subprocess.Popen(args,
stdin=subprocess.PIPE,
stdout=self.stdout,
stderr=self.stderr,
close_fds=True)
except OSError, details:
if details.errno == 2:
exc = OSError("File '%s' not found" % args[0])
exc.errno = 2
raise exc
else:
raise
if wait_until_running:
self._wait_until_running()
......
......@@ -274,11 +274,20 @@ class SubProcess(object):
cmd = shlex.split(self.cmd)
else:
cmd = self.cmd
self._popen = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=self.shell,
env=self.env)
try:
self._popen = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=self.shell,
env=self.env)
except OSError, details:
if details.errno == 2:
exc = OSError("File '%s' not found" % self.cmd.split[0])
exc.errno = 2
raise exc
else:
raise
self.start_time = time.time()
self.stdout_file = StringIO.StringIO()
self.stderr_file = StringIO.StringIO()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册