danielgtaylor / jpeg-archive

Utilities for archiving JPEGs for long term storage.
1.17k stars 121 forks source link

Failure to read from stdin #84

Closed rikonor closed 6 years ago

rikonor commented 6 years ago

Hi,

The following fails:

# Substituting stdin
$ cat img.jpg  | jpeg-recompress - img.min.jpg
invalid input file: -

The following succeeds:

# No substitution
$ jpeg-recompress img.jpg img.min.jpg

# Substituting stdio
$ jpeg-recompress img.jpg - > img.min.jpg

Based on https://github.com/danielgtaylor/jpeg-archive/issues/9 I was hoping to be able to stream a file via stdin.

I had also tried doing something similar using named pipes:

# terminal 1
$ mkfifo inPipe
$ cat img.jpg > inPipe

# terminal 2
$ mkfifo outPipe
$ cat outPipe > img.min.jpg

# terminal 3
$ jpeg-recompress inPipe outPipe

In the above, terminal 1 will finish, but terminal 2 and terminal 3 will hang forever.

Tested all of the above on linux and osx.

rikonor commented 6 years ago

This should be solved by https://github.com/danielgtaylor/jpeg-archive/pull/85

lfos commented 6 years ago

Fixed in 76b1868 (Only read input once, 2018-03-14).