Skip to content

Commit

Permalink
use @jschobben's version that uses mktemp
Browse files Browse the repository at this point in the history
  • Loading branch information
heilig authored and jschobben committed Apr 21, 2024
1 parent 57d29d8 commit 869e745
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions colorscad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,9 @@ INPUT=${INPUT##*/}

# Create a temporary, unique .csg file in the input's directory.
# It needs to be in the input's directory, because it might contain relative "import" statements.
# On macOS, 'mktemp' cannot create a file with a given extension, so use a workaround.
# On macOS, 'mktemp' does not expand the XXXs because there's a .csg suffix, so use a workaround.
INPUT_CSG=$(
set -o noclobber
NAME=tmp.$$_${RANDOM}.csg
while [ -f "$NAME" ]; do
NAME=tmp.$$_${RANDOM}.csg
done 2>/dev/null
echo "$NAME"
until mktemp "tmp.$$_${RANDOM}_XXXXXX.csg"; do sleep 1; done
)
[ -z "$INPUT_CSG" ] && exit
# Working directory. Use a dir relative to the input dir, because openscad might not have access to
Expand Down

0 comments on commit 869e745

Please sign in to comment.