Merge pull request #3518 from radarhere/imageshow

im.show: Fix writing to temporary file
This commit is contained in:
Hugo 2018-12-31 12:34:43 +02:00 committed by GitHub
commit b9d102ea70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,9 +132,9 @@ elif sys.platform == "darwin":
def show_file(self, file, **options):
"""Display given file"""
f, path = tempfile.mkstemp()
f.write(file)
f.close()
fd, path = tempfile.mkstemp()
with os.fdopen(fd, 'w') as f:
f.write(file)
with open(path, "r") as f:
subprocess.Popen([
'im=$(cat);'
@ -171,9 +171,9 @@ else:
def show_file(self, file, **options):
"""Display given file"""
f, path = tempfile.mkstemp()
f.write(file)
f.close()
fd, path = tempfile.mkstemp()
with os.fdopen(fd, 'w') as f:
f.write(file)
with open(path, "r") as f:
command = self.get_command_ex(file, **options)[0]
subprocess.Popen([