From 6e9f3cf0a99a121f1e9c16cd54ac1e9a16d3e597 Mon Sep 17 00:00:00 2001 From: Ari Archer Date: Mon, 30 Oct 2023 13:06:52 +0200 Subject: [PATCH] update @ Mon Oct 30 13:06:52 EET 2023 Signed-off-by: Ari Archer --- scripts/blog.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/blog.py b/scripts/blog.py index f0de243..4330798 100755 --- a/scripts/blog.py +++ b/scripts/blog.py @@ -582,7 +582,11 @@ def get_tmpfile(name: str) -> str: def open_file(editor: typing.Sequence[str], path: str) -> None: log(f"formatting and running {editor!r} with {path!r}") - subprocess.run([(token.replace("%s", path)) for token in editor]) + + try: + subprocess.run([(token.replace("%s", path)) for token in editor]) + except Exception as e: + sys.exit(err(f"failed to run editor : {e}")) def trunc(data: str, length: int, end: str = " ...") -> str: @@ -908,6 +912,9 @@ def rm(config: dict[str, typing.Any]) -> int: def build(config: dict[str, typing.Any]) -> int: """build blog posts""" + if not config["posts"]: + return err("no posts to be built") + log("compiling regex") web_mini.html.html_fns.compileall()