summaryrefslogtreecommitdiff
path: root/gobject/valaccodecompiler.vala
diff options
context:
space:
mode:
Diffstat (limited to 'gobject/valaccodecompiler.vala')
-rw-r--r--gobject/valaccodecompiler.vala29
1 files changed, 16 insertions, 13 deletions
diff --git a/gobject/valaccodecompiler.vala b/gobject/valaccodecompiler.vala
index 9d7e2d1ed..2de7a591d 100644
--- a/gobject/valaccodecompiler.vala
+++ b/gobject/valaccodecompiler.vala
@@ -49,12 +49,14 @@ public class Vala.CCodeCompiler {
}
string pkgflags;
int exit_status;
- Error err = null;
- if (!Process.spawn_command_line_sync (pc, out pkgflags, null, ref exit_status, out err)) {
- Report.error (null, err.message);
- return;
- } else if (exit_status != 0) {
- Report.error (null, "pkg-config exited with status %d".printf (exit_status));
+ try {
+ Process.spawn_command_line_sync (pc, out pkgflags, null, out exit_status);
+ if (exit_status != 0) {
+ Report.error (null, "pkg-config exited with status %d".printf (exit_status));
+ return;
+ }
+ } catch (SpawnError e) {
+ Report.error (null, e.message);
return;
}
@@ -80,7 +82,14 @@ public class Vala.CCodeCompiler {
}
}
- bool success = Process.spawn_command_line_sync (cmdline, null, null, ref exit_status, out err);
+ try {
+ Process.spawn_command_line_sync (cmdline, null, null, out exit_status);
+ if (exit_status != 0) {
+ Report.error (null, "cc exited with status %d".printf (exit_status));
+ }
+ } catch (SpawnError e) {
+ Report.error (null, e.message);
+ }
/* remove generated C source and header files */
foreach (SourceFile file in source_files) {
@@ -89,11 +98,5 @@ public class Vala.CCodeCompiler {
FileUtils.unlink (file.get_cheader_filename ());
}
}
-
- if (!success) {
- Report.error (null, err.message);
- } else if (exit_status != 0) {
- Report.error (null, "cc exited with status %d".printf (exit_status));
- }
}
}