From 9df946508076c4092be5ca5c6b04a21f804636a3 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Fri, 21 Jun 2019 20:02:50 +0200 Subject: [PATCH] Only check for port availability when not in watch-only for serve Closes #712 --- src/main.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 94a4344..c6dc2ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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...");