diff --git a/mode/c.py b/mode/c.py index a801ea5..0fcf6a4 100644 --- a/mode/c.py +++ b/mode/c.py @@ -256,16 +256,19 @@ class CMake(method.Method): p = popen2.Popen4(w.mode.makecmd) p.tochild.close() output = p.fromchild.read() + result = p.wait() + status = os.WEXITSTATUS(result) if not os.WIFEXITED(result): - sig = os.WTERMSIG(result) - w.application.data_buffer("*CMake*", output, switch_to=True) - w.set_error("make: killed by signal %r" % sig) + err = True + errmsg = "make: killed by signal %r" % os.WTERMSIG(result) + elif status != 0: + err = True + errmsg = "make: failed with status %r" % status else: - status = os.WEXITSTATUS(result) - if status == 0: - w.set_error("make: OK") - else: - w.application.data_buffer("*CMake*", output, switch_to=True) - w.set_error("make: failed with status %r" % status) + err = False + errmsg = "make: OK (output in *CMake*)" + + w.application.data_buffer("*CMake*", output, switch_to=err) + w.set_error(errmsg)