Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
diceware-debian
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drebs
diceware-debian
Commits
7cd0b713
Commit
7cd0b713
authored
9 years ago
by
ulif
Browse files
Options
Downloads
Patches
Plain Diff
Fix pipe problem.
Input from sys.stdin is valid but not seekable. Cope with that.
parent
6ff26c93
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
diceware/wordlist.py
+8
-0
8 additions, 0 deletions
diceware/wordlist.py
with
8 additions
and
0 deletions
diceware/wordlist.py
+
8
−
0
View file @
7cd0b713
...
...
@@ -17,6 +17,11 @@
"""
import
os
import
re
import
sys
try
:
# pragma: no cover
from
StringIO
import
StringIO
except
ImportError
:
# pragma: no cover
from
io
import
StringIO
#: The directory in which wordlists are stored
WORDLISTS_DIR
=
os
.
path
.
abspath
(
...
...
@@ -89,6 +94,9 @@ class WordList(object):
"""
def
__init__
(
self
,
path_or_filelike
=
None
):
self
.
path
=
None
# XXX: Need a regression test here: does piping in work?
if
path_or_filelike
is
sys
.
stdin
:
path_or_filelike
=
StringIO
(
path_or_filelike
.
read
())
if
not
hasattr
(
path_or_filelike
,
'
seek
'
):
# got a path, not a filelike object
self
.
path
=
path_or_filelike
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment