Subject: Do not create output file on error

From: Arun Isaac <[email-masked]>
Date: Sun, 27 Mar 2022 14:21:35 +0530

Skribilo creates an empty output file even when it errors out. For
example, if I invoke skribilo as follows with foo.skb being
non-existent, skribilo will error out but still create a foo.html.

--8<---------------cut here---------------start------------->8---
$ ls foo.html
ls: cannot access 'foo.html': No such file or directory

$ ls foo.skb
ls: cannot access 'foo.skb': No such file or directory

$ skribilo -t html -o foo.html foo.skb
Backtrace:
In ice-9/boot-9.scm:
  1752:10 10 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In unknown file:
           9 (apply-smob/0 #<thunk 7f583ec7d2e0>)
In ice-9/boot-9.scm:
    724:2  8 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8  7 (_ #(#(#<directory (guile-user) 7f583ec83c80>)))
In ice-9/command-line.scm:
   185:19  6 (_ #<input: string 7f583ec7c850>)
In unknown file:
           5 (eval (call-with-skribilo-error-catch/exit (lambda () (apply (module-ref (resolve-interface (quote (skribilo))) (quote skribilo)) (cdr (command-line))))) #<directory (guile-user) 7f583ec83c80>)
In ice-9/boot-9.scm:
  1752:10  4 (with-exception-handler _ _ #:unwind? _ #:unwind-for-type _)
In skribilo.scm:
   429:14  3 (skribilo . _)
In ice-9/ports.scm:
   450:11  2 (call-with-input-file "foo.skb" #<procedure 7f583ec69e60 at ice-9/ports.scm:494:3 (p)> #:binary _ #:encoding _ #:guess-encoding _)
In unknown file:
           1 (open-file "foo.skb" "r" #:encoding #f #:guess-encoding #f)
In ice-9/boot-9.scm:
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure open-file: No such file or directory: "foo.skb"

$ ls foo.html
foo.html
--8<---------------cut here---------------end--------------->8---

Among other things, this upsets the use of skribilo in Makefiles. When a
skribilo invocation in a Makefile recipe fails, an output file is still
created, and when make is run again, the skribilo invocation is not
re-run.