fixed terminal encoding bug with exec

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-08-20 00:27:39 -04:00
parent 72bdc0915a
commit 9840cb4806
1 changed files with 11 additions and 6 deletions

View File

@ -30,6 +30,11 @@ class Exec(Method):
result = p.wait()
status = os.WEXITSTATUS(result)
try:
output2 = output.decode('utf-8')
except:
output2 = output.decode('latin-1')
if not os.WIFEXITED(result) or status != 0:
err = True
msg = "failed to exec %r" % cmdname
@ -37,9 +42,9 @@ class Exec(Method):
err = False
msg = "exec(%r): ok" % (cmdname,)
if output:
if output2:
switch_to = err or self.show_success
w.application.data_buffer(bufname, output, switch_to=switch_to)
w.application.data_buffer(bufname, output2, switch_to=switch_to)
w.set_error(msg)
def _execute(self, w, **vargs):