Comment 1 for bug 1629680

Revision history for this message
pipping (pipping) wrote :

I've thought a bit about this. One way to address this that came to mind would be to precede the actual call in %system by

  (with-open-file (dummy output :direction-output :if-file-exists if-output-exists))

and to additionally turn '> output' into '>> output'.

This should do the right thing for
 - :if-output-exists :error (because with-open-file will signal an error)
 - :if-output-exists :supersede (with-open-file will discard the old file and leave an empty one that we'll then append to)
 - :if-output-exists :append (with-open-file will signal an error if the file is missing; otherwise, it will append nothing on its own and we'll append to the existing file)

What I'm afraid this would handle properly I'm afraid is
 - :if-output-exists nil

(which raises the question: which values of :if-output-exists do we support anyway? :overwrite is currently treated as :supersede e.g. because the error signalling of :overwrite does not work reliably in %run-program/launch-program)