Skip to content
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

No output to standard out in case of error #44

Open
amosnier opened this issue Mar 1, 2023 · 3 comments
Open

No output to standard out in case of error #44

amosnier opened this issue Mar 1, 2023 · 3 comments

Comments

@amosnier
Copy link

amosnier commented Mar 1, 2023

Was discussed in #43, but I now create a specific issue, for the sake of clarity. @sorawee, please feel free to (re-)close #43 if you think nothing should be done about the comment "issue".

Minimal example for this issue:

$ raco fmt
4
4

Please note that after the first 4, I press <return> and <ctrl-d>. raco fmt then outputs my unchanged input, which is what I expect. On the other hand:

$ raco fmt
(define
1:1:0: expected a ) to close (
context...:
/usr/local/share/racket/collects/syntax/readerr.rkt:15:2: -raise-read-error
.../match/compiler.rkt:559:40: f123
/home/alain/.local/share/racket/8.8/pkgs/fmt/read.rkt:123:0: read-top
/home/alain/.local/share/racket/8.8/pkgs/fmt/main.rkt:27:0: program-format
/home/alain/.local/share/racket/8.8/pkgs/fmt/raco.rkt:115:0
body of "/home/alain/.local/share/racket/8.8/pkgs/fmt/raco.rkt"
/usr/local/share/racket/collects/raco/raco.rkt:41:0
body of "/usr/local/share/racket/collects/raco/raco.rkt"
body of "/usr/local/share/racket/collects/raco/main.rkt"

That is when pressing <return> and <ctrl-d> after (define. There my input is gone, which might be intended, but makes the program unusable as a filter, as far as I know.

For the sake of completion, what raco fmt -i does is as far as I know perfectly fine. This issue is only relevant when the output is sent to standard out (and standard error) in case of error. Getting the error message to standard error is then perfectly fine too, since it can easily be redirected. The issue in this case is that nothing comes to standard out. That prevents the program from being used as a true filter, which would be composable through pipelines (typical UNIX principle). In that case, just outputting the input to standard out would solve this issue.

@sorawee
Copy link
Owner

sorawee commented Mar 1, 2023

Thanks! I'm currently busy with deadlines. Will take a look after my life is better.

@amosnier
Copy link
Author

amosnier commented Mar 1, 2023

For the record, I have created raco-fmt-or-cat for my own short term needs. And of course, that's because I really like raco fmt, by the way.

@amosnier
Copy link
Author

Please see benknoble/vim-racket#11 (comment). What I'm explaining in that comment is basically that I no longer consider what I described here as an issue. In other words, as far as I am concerned, this issue may be closed. I will also make my workaround private, as I would not recommend anybody to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants