Fix zola serve

This commit is contained in:
Vincent Prouillet 2020-09-28 09:36:16 +02:00
parent 0230e3297f
commit 94c016521c
5 changed files with 11 additions and 10 deletions

View file

@ -1,6 +1,8 @@
# Changelog # Changelog
## 0.13.0 (unreleased) ## 0.12.2 (2020-09-28)
- Fix `zola serve` being broken on reload
## 0.12.1 (2020-09-27) ## 0.12.1 (2020-09-27)

2
Cargo.lock generated
View file

@ -2995,7 +2995,7 @@ dependencies = [
[[package]] [[package]]
name = "zola" name = "zola"
version = "0.13.0" version = "0.12.2"
dependencies = [ dependencies = [
"atty", "atty",
"chrono", "chrono",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "zola" name = "zola"
version = "0.13.0" version = "0.12.2"
authors = ["Vincent Prouillet <hello@vincentprouillet.com>"] authors = ["Vincent Prouillet <hello@vincentprouillet.com>"]
edition = "2018" edition = "2018"
license = "MIT" license = "MIT"

View file

@ -3,7 +3,6 @@ title = "Overview"
weight = 10 weight = 10
+++ +++
Zola uses the directory structure to determine the site structure. Zola uses the directory structure to determine the site structure.
Each child directory in the `content` directory represents a [section](@/documentation/content/section.md) Each child directory in the `content` directory represents a [section](@/documentation/content/section.md)
that contains [pages](@/documentation/content/page.md) (your `.md` files). that contains [pages](@/documentation/content/page.md) (your `.md` files).

View file

@ -184,12 +184,6 @@ fn create_new_site(
let base_address = format!("{}:{}", base_url, interface_port); let base_address = format!("{}:{}", base_url, interface_port);
let address = format!("{}:{}", interface, interface_port); let address = format!("{}:{}", interface, interface_port);
// Stop right there if we can't bind to the address
let bind_address: SocketAddrV4 = address.parse().unwrap();
if (TcpListener::bind(&bind_address)).is_err() {
return Err(format!("Cannot start server on address {}.", address))?;
}
let base_url = if site.config.base_url.ends_with('/') { let base_url = if site.config.base_url.ends_with('/') {
format!("http://{}/", base_address) format!("http://{}/", base_address)
} else { } else {
@ -239,6 +233,12 @@ pub fn serve(
)?; )?;
console::report_elapsed_time(start); console::report_elapsed_time(start);
// Stop right there if we can't bind to the address
let bind_address: SocketAddrV4 = address.parse().unwrap();
if (TcpListener::bind(&bind_address)).is_err() {
return Err(format!("Cannot start server on address {}.", address))?;
}
// An array of (path, bool, bool) where the path should be watched for changes, and the boolean value // An array of (path, bool, bool) where the path should be watched for changes, and the boolean value
// indicates whether this file/folder must exist for zola serve to operate // indicates whether this file/folder must exist for zola serve to operate
let watch_this = vec![ let watch_this = vec![