Handle pipes via process substitution #206
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FWIW I'm not a python developer so this code may have repercussions that I'm unable to diagnose.
Background
I'm doing some manual templating on config files for two programs: khal and khard, both of which use configobj. Neither program allows for interpolation in the config files, so I was required to roll my own. Essentially, I run these programs with a wrapper like this:
Sourcing
pimenv
provides a bunch of environment variables which are interpolated into the config file using envsubst with process substitution, producing a file descriptor (/dev/fd/63
).On Linux, at least,
os.path.isfile()
returnsFalse
for this descriptor, butos.path.islink()
returns True. As a result, even though the file is readable, configobj never tries to read it and throws an error.The Fix
Well, the code is pretty self-explanatory. I've tested this under both khal and khard, and found that everything works as expected now. Interestingly,
os.path.isfile()
does return True for a symlink, so this is probably quite an edge case.