improved error messages for man/exec

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-08-16 01:06:11 -04:00
parent f6f225eaf8
commit 16d55b4bc9
1 changed files with 6 additions and 12 deletions

View File

@ -30,15 +30,12 @@ class Exec(Method):
result = p.wait()
status = os.WEXITSTATUS(result)
if not os.WIFEXITED(result):
if not os.WIFEXITED(result) or status != 0:
err = True
msg = "%s: killed by signal %r" % (cmdname, os.WTERMSIG(result))
elif status != 0:
err = True
msg = "%s: failed with status %r" % (cmdname, status)
msg = "failed to exec %r" % cmdname
else:
err = False
msg = "%s: ok" % (cmdname,)
msg = "exec(%r): ok" % (cmdname,)
if output:
switch_to = err or self.show_success
@ -66,15 +63,12 @@ class Man(Exec):
output = p.stdout.read()
result = p.wait()
status = os.WEXITSTATUS(result)
if not os.WIFEXITED(result):
if not os.WIFEXITED(result) or status != 0:
err = True
errmsg = "man: killed by signal %r" % os.WTERMSIG(result)
elif status != 0:
err = True
errmsg = "man: failed with status %r" % status
errmsg = "found no page for %r" % name
else:
err = False
errmsg = "man: ok"
errmsg = "man(%r): ok" % name
if output:
xterm = XTerm(cbuf=True)
s = xterm.term_filter(output)