New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
prettybat can't read from pipe #51
Comments
While trying to investigate formatting of XML/SVG I also (accidentally) passed prettier output prettybat via pipe and got this potentially helpful output: $ prettier attention.svg --parser=html | pcat
[prettybat error]: -: No such file or directory
node:events:346
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:160:15)
at writeGeneric (node:internal/stream_base_commons:151:3)
at Socket._writeGeneric (node:net:773:11)
at Socket._write (node:net:785:8)
at writeOrBuffer (node:internal/streams/writable:395:12)
at Socket.Writable.write (node:internal/streams/writable:340:10)
at writeOutput (/usr/lib/prettier/bin-prettier.js:15761:18)
at Object.formatFiles (/usr/lib/prettier/bin-prettier.js:16111:7)
at Object.run (/usr/lib/prettier/bin-prettier.js:16538:14)
at Object.<anonymous> (/usr/lib/prettier/bin-prettier.js:16553:5)
Emitted 'error' event on Socket instance at:
at emitErrorNT (node:internal/streams/destroy:188:8)
at emitErrorCloseNT (node:internal/streams/destroy:153:3)
at processTicksAndRejections (node:internal/process/task_queues:81:21) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
} |
Fixed in 8606387, but with a caveat. Because STDIN doesn't have a file extension, it won't know what formatter to use. You'll need to use |
Great, thanks, this works nicely already! I see that |
It would be a bit of work, unfortunately. When I was actually thinking of eventually rewriting |
That sounds like a good plan. Looking at it again, Maybe for types that |
Are there any updates on automatic syntax detection? I would love to use |
When trying to preview a remote file (e.g. an installer shell script) I'd like to be able to fetch a file from a server with curl and pipe the result to prettybat. This works fine when using just bat for the syntax highlighting, but prettybat either doesn't seem to support that use case or needs to be fixed.
$ curl https://sh.rustup.rs | prettybat % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0[prettybat error]: -: No such file or directory 85 18636 85 15971 0 0 318k 0 --:--:-- --:--:-- --:--:-- 318k curl: (23) Failure writing output to destination
It would be nice if this could be supported.
The text was updated successfully, but these errors were encountered: