From 16d55b4bc9ece95b33149d36b2ff0eaca6cfe2e8 Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Sun, 16 Aug 2009 01:06:11 -0400 Subject: [PATCH] improved error messages for man/exec --HG-- branch : pmacs2 --- method/shell.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/method/shell.py b/method/shell.py index 1c5d62d..2ebd83f 100644 --- a/method/shell.py +++ b/method/shell.py @@ -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)