Skip to content

Commit

Permalink
Auto merge of #6285 - mbrubeck:nofile, r=metajack
Browse files Browse the repository at this point in the history
* Don't hang silently when passed a non-existant file.
* Fix uncaught exception in `mach run` when Servo fails.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6285)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Jun 4, 2015
2 parents 0bbc282 + 4b5c438 commit 9b5a01e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/util/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#![feature(core)]
#![feature(exit_status)]
#![feature(optin_builtin_traits)]
#![cfg_attr(not(target_os = "android"), feature(path_ext))]
#![feature(path_ext)]
#![feature(plugin)]
#![feature(rustc_private)]
#![feature(step_by)]
Expand Down
12 changes: 10 additions & 2 deletions components/util/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ use std::collections::HashSet;
use std::cmp;
use std::env;
use std::io::{self, Write};
use std::fs::PathExt;
use std::mem;
use std::path::Path;
use std::ptr;
use url::{self, Url};

Expand Down Expand Up @@ -310,8 +312,14 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
let cwd = env::current_dir().unwrap();
match Url::parse(url) {
Ok(url) => url,
Err(url::ParseError::RelativeUrlWithoutBase)
=> Url::from_file_path(&*cwd.join(url)).unwrap(),
Err(url::ParseError::RelativeUrlWithoutBase) => {
if Path::new(url).exists() {
Url::from_file_path(&*cwd.join(url)).unwrap()
} else {
args_fail(&format!("File not found: {}", url));
return false;
}
}
Err(_) => panic!("URL parsing failed"),
}
};
Expand Down
3 changes: 3 additions & 0 deletions python/servo/post_build_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def run(self, params, release=False, dev=False, debug=False, debugger=None):

try:
subprocess.check_call(args, env=env)
except subprocess.CalledProcessError as e:
print("Servo exited with return value %d" % e.returncode)
return e.returncode
except OSError as e:
if e.errno == 2:
print("Servo Binary can't be found! Run './mach build'"
Expand Down

0 comments on commit 9b5a01e

Please sign in to comment.