Skip to content

Commit f1dd9bd

Browse files
authored
add support for stdin input file by setting -
1 parent 4e29ee5 commit f1dd9bd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pycpio/reader/reader.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ class CPIOReader:
1717

1818
def __init__(self, input_file: Union[Path, str], overrides={}, *args, **kwargs):
1919
self.file_path = Path(input_file)
20-
assert self.file_path.exists(), "File does not exist: %s" % self.file_path
20+
21+
if self.file_path == Path('-'):
22+
# stdin
23+
self.file_path = 0
24+
else:
25+
# normal file
26+
assert self.file_path.exists(), "File does not exist: %s" % self.file_path
2127

2228
self.overrides = overrides
2329
self.entries = CPIOArchive(logger=self.logger)

0 commit comments

Comments
 (0)