Only check for port availability when not in watch-only for serve

Closes #712
This commit is contained in:
Vincent Prouillet 2019-06-21 20:02:50 +02:00
parent df720a5baf
commit 9df9465080

View file

@ -64,13 +64,15 @@ fn main() {
::std::process::exit(1);
}
};
let watch_only = matches.is_present("watch_only");
// Default one
if port != 1111 && !port_is_available(port) {
if port != 1111 && !watch_only && !port_is_available(port) {
console::error("The requested port is not available");
::std::process::exit(1);
}
if !port_is_available(port) {
if !watch_only && !port_is_available(port) {
port = if let Some(p) = get_available_port(1111) {
p
} else {
@ -78,7 +80,6 @@ fn main() {
::std::process::exit(1);
}
}
let watch_only = matches.is_present("watch_only");
let output_dir = matches.value_of("output_dir").unwrap();
let base_url = matches.value_of("base_url").unwrap();
console::info("Building site...");