FR. Using stdin as input
Opened this issue · 1 comments
This is really the best solution to handle a *.vma outside of ProxMox.
But typically we face with compressed *.vma.gz
format, so we have to write a BIG file twice:
*.vma.gz --> *.vma
*.vma --> *.raw
Actually we need a triple free disk space (vma.gz + vma + raw) at a time.
It would be perfect if the script has the ability to use stdin as input (as origin vma has), so we can use it in such a way:
zcat big.vma.gz | vma.py - /tmp/big-vma-extracted
Unfortunately named pipe doesn't work:
$ mkfifo blackhole
$ zcat big.vma.gz > blackhole &
$ vma.py blackhole /tmp/big-vma-extracted
[1] + 237676 broken pipe zcat big.vma.gz > blackhole
Traceback (most recent call last):
File "vma.py", line 357, in <module>
sys.exit(main())
File "vma.py", line 352, in main
extract(fo, args)
File "vma.py", line 239, in extract
fo.seek(0, os.SEEK_END)
io.UnsupportedOperation: File or stream is not seekable.
Thank you for your work!
Sounds like a good idea. Especially getting named pipes to work shouldn't require too much thought. As far as I remember random seeking is only required for the output size anyways.
And I have no idea why I did the wierd seek, tell and seek thingy to get the filesize ahead of time, when I could just run the loop until EOF... 😅