improved error messages for man/exec
--HG-- branch : pmacs2
This commit is contained in:
parent
f6f225eaf8
commit
16d55b4bc9
|
@ -30,15 +30,12 @@ class Exec(Method):
|
||||||
result = p.wait()
|
result = p.wait()
|
||||||
status = os.WEXITSTATUS(result)
|
status = os.WEXITSTATUS(result)
|
||||||
|
|
||||||
if not os.WIFEXITED(result):
|
if not os.WIFEXITED(result) or status != 0:
|
||||||
err = True
|
err = True
|
||||||
msg = "%s: killed by signal %r" % (cmdname, os.WTERMSIG(result))
|
msg = "failed to exec %r" % cmdname
|
||||||
elif status != 0:
|
|
||||||
err = True
|
|
||||||
msg = "%s: failed with status %r" % (cmdname, status)
|
|
||||||
else:
|
else:
|
||||||
err = False
|
err = False
|
||||||
msg = "%s: ok" % (cmdname,)
|
msg = "exec(%r): ok" % (cmdname,)
|
||||||
|
|
||||||
if output:
|
if output:
|
||||||
switch_to = err or self.show_success
|
switch_to = err or self.show_success
|
||||||
|
@ -66,15 +63,12 @@ class Man(Exec):
|
||||||
output = p.stdout.read()
|
output = p.stdout.read()
|
||||||
result = p.wait()
|
result = p.wait()
|
||||||
status = os.WEXITSTATUS(result)
|
status = os.WEXITSTATUS(result)
|
||||||
if not os.WIFEXITED(result):
|
if not os.WIFEXITED(result) or status != 0:
|
||||||
err = True
|
err = True
|
||||||
errmsg = "man: killed by signal %r" % os.WTERMSIG(result)
|
errmsg = "found no page for %r" % name
|
||||||
elif status != 0:
|
|
||||||
err = True
|
|
||||||
errmsg = "man: failed with status %r" % status
|
|
||||||
else:
|
else:
|
||||||
err = False
|
err = False
|
||||||
errmsg = "man: ok"
|
errmsg = "man(%r): ok" % name
|
||||||
if output:
|
if output:
|
||||||
xterm = XTerm(cbuf=True)
|
xterm = XTerm(cbuf=True)
|
||||||
s = xterm.term_filter(output)
|
s = xterm.term_filter(output)
|
||||||
|
|
Loading…
Reference in New Issue