about summary refs log tree commit diff
path: root/src/libnative
diff options
context:
space:
mode:
Diffstat (limited to 'src/libnative')
-rw-r--r--src/libnative/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs
index b3b83fda599..9c30e94194d 100644
--- a/src/libnative/lib.rs
+++ b/src/libnative/lib.rs
@@ -73,7 +73,8 @@ pub fn start(argc: int, argv: **u8, main: proc()) -> int {
         exit_code = Some(run(main.take_unwrap()));
     });
     unsafe { rt::cleanup(); }
-    return exit_code.unwrap();
+    // If the exit code wasn't set, then the task block must have failed.
+    return exit_code.unwrap_or(rt::DEFAULT_ERROR_CODE);
 }
 
 /// Executes a procedure on the current thread in a Rust task context.