Browse Source

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

Closes #712
index-subcmd
Vincent Prouillet 5 years ago
parent
commit
9df9465080
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      src/main.rs

+ 4
- 3
src/main.rs View File

@@ -64,13 +64,15 @@ fn main() {
::std::process::exit(1); ::std::process::exit(1);
} }
}; };
let watch_only = matches.is_present("watch_only");

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


Loading…
Cancel
Save