chiark / gitweb /
run-inkscape-extension: Work around a weird inkscape behaviour
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 15 May 2022 14:58:12 +0000 (15:58 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 15 May 2022 19:26:01 +0000 (20:26 +0100)
Without this, generic recolour instructions in shape libraries don't
work right if some of the recolourings don't apply to some of the
image files in the group.  Which is about to be the case.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
run-inkscape-extension

index b5a60fb56083b379fbf1417e88f5eed591add33d..8a860c0c3fa85f96d6e6952e3f9ee01f46682825 100755 (executable)
 #   - If these scripts are executable, they can be executed
 #   - Otherwise, they are not using ancient and obsolete python
 
+set -e
+
 $(
   if test -x "$1"; then :; else
     type -p python3 || type -p python
   fi
 ) "$@"
+
+# Additionally, sometimes inkscape doesn't write the output file.  It
+# likes to do this if "nothing changed", presumably because of some
+# "don't save non-dirty files" logic.  That is really nto very
+# convenient here!
+
+if test -f /dev/stdout; then
+  if test -s /dev/stdout; then :; else
+    x=("$@");
+    cat ${x[-1]}
+  fi
+fi