Skip to content

Commit

Permalink
fix: Write STDIN to a temporary file
Browse files Browse the repository at this point in the history
  • Loading branch information
kesara committed Sep 30, 2024
1 parent 74c59f6 commit 8115b9a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion svgcheck/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import optparse
import os
import shutil
import tempfile
import lxml.etree
from svgcheck.checksvg import checkTree
from svgcheck.__init__ import __version__
Expand Down Expand Up @@ -107,7 +108,10 @@ def main():
wp.color_threshold = options.grey_level

if len(args) < 1:
source = "CON" if sys.platform.startswith("win") else "/dev/stdin"
with tempfile.NamedTemporaryFile(dir=options.cache, delete=False, mode="w+t") as tmp_file:
data = sys.stdin.read()
tmp_file.write(data)
source = tmp_file.name
else:
source = args[0]
if not os.path.exists(source):
Expand Down

0 comments on commit 8115b9a

Please sign in to comment.