mirror of
https://github.com/quantum5/win2xcur.git
synced 2025-04-24 10:11:57 -04:00
Fix xcursorgen generating incorrect output to stdout
This commit is contained in:
parent
0391d63e5e
commit
a9b6711228
|
@ -40,10 +40,15 @@ def to_x11(frames: List[CursorFrame]) -> bytes:
|
|||
image.save(filename=os.path.join(png_dir, name))
|
||||
counter += 1
|
||||
|
||||
process = subprocess.Popen(['xcursorgen', '-p', png_dir], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
result, error = process.communicate('\n'.join(configs).encode(sys.getfilesystemencoding()))
|
||||
output_file = os.path.join(png_dir, 'cursor')
|
||||
process = subprocess.Popen(['xcursorgen', '-p', png_dir, '-', output_file], stdin=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
|
||||
if error:
|
||||
_, error = process.communicate('\n'.join(configs).encode(sys.getfilesystemencoding()))
|
||||
if process.wait() != 0:
|
||||
raise RuntimeError('xcursorgen failed: %r' % error)
|
||||
|
||||
with open(output_file, 'rb') as f:
|
||||
result = f.read()
|
||||
|
||||
return result
|
||||
|
|
Loading…
Reference in a new issue