aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeegan McAllister <kmcallister@mozilla.com>2014-02-11 16:55:14 -0800
committerKeegan McAllister <kmcallister@mozilla.com>2014-02-12 18:07:32 -0800
commitce603a06b70398750cff16331151849514eb97a4 (patch)
treec454340e575f7b2cb6a008b57cc2e19fd082ae07 /src
parent36b8f6398448b7f75705edc10061dde9402fe7af (diff)
downloadservo-ce603a06b70398750cff16331151849514eb97a4.tar.gz
servo-ce603a06b70398750cff16331151849514eb97a4.zip
Restore hard-fail mode
Diffstat (limited to 'src')
-rw-r--r--src/components/main/constellation.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs
index 770047c3ddd..9758f4db2af 100644
--- a/src/components/main/constellation.rs
+++ b/src/components/main/constellation.rs
@@ -26,6 +26,8 @@ use servo_util::url::parse_url;
use servo_util::task::spawn_named;
use std::hashmap::{HashMap, HashSet};
use std::util::replace;
+use std::io;
+use std::libc;
/// Maintains the pipelines and navigation context and grants permission to composite
pub struct Constellation {
@@ -384,6 +386,15 @@ impl Constellation {
fn handle_failure_msg(&mut self, pipeline_id: PipelineId, subpage_id: Option<SubpageId>) {
debug!("handling failure message from pipeline {:?}, {:?}", pipeline_id, subpage_id);
+ if self.opts.hard_fail {
+ // It's quite difficult to make Servo exit cleanly if some tasks have failed.
+ // Hard fail exists for test runners so we crash and that's good enough.
+ let mut stderr = io::stderr();
+ stderr.write_str("Pipeline failed in hard-fail mode. Crashing!\n");
+ stderr.flush();
+ unsafe { libc::exit(1); }
+ }
+
let old_pipeline = match self.pipelines.find(&pipeline_id) {
None => return, // already failed?
Some(id) => *id