allowing loading from input paths that do not support seeking #971
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.
Based on the approach by @rmolives in #966. The difference here is more specific checking for
ESPIPEto make sure that the reasonlseekfailed is that a device does not support seeking.Seeking is used by
do-loadfor three reasons: to check for a starting#!line to treat as a comment, to check whether the input is a compiled file, and to create a source-file description to be used later (if possible) to convert positions to lines and columns. The last of those really expects a regular file, so it could be avoiding when seeking is not supported, and the other two could be handled by generalizing peeking/ungetting for a small, bounded number of characters. But probably reading everything into a bytevector before parsing is good enough for this small corner.