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

zed and file descriptors lead to incosistent behaviour #59

Closed
bracki opened this issue Oct 28, 2021 · 1 comment · Fixed by #60
Closed

zed and file descriptors lead to incosistent behaviour #59

bracki opened this issue Oct 28, 2021 · 1 comment · Fixed by #60
Labels
area/CLI Affects the command line kind/tech debt Addresses legacy code/decisions priority/2 medium This needs to be done

Comments

@bracki
Copy link
Contributor

bracki commented Oct 28, 2021

Expected behaviour

zed schema read > my_schema.txt
# edit the schema ...
zed schema write my_schema.txt

Actual behaviour

zed schema write my_schema.txt
{"level":"fatal","error":"rpc error: code = InvalidArgument desc = error parsing schema: parse error in `schema`, line 1, column 1: Unexpected token at root level: TokenTypeLeftBrace","time":"2021-10-28T10:36:37+02:00","message":"failed to write schema"}

This is because whenever zed detects a fd it will switch to JSON/pretty mode. This makes scripting things hard.

Possible solution

Either make formats explicit and don't do autodetection or be compatible when piping/reading into zed.

@jzelinskie
Copy link
Member

Yep, we've had this discussion before that this behavior is undocumented and unintuitive.
Not all outputs make sense as JSON, either.
I think we can drop this behavior for now.

@jzelinskie jzelinskie added area/CLI Affects the command line kind/tech debt Addresses legacy code/decisions priority/2 medium This needs to be done labels Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CLI Affects the command line kind/tech debt Addresses legacy code/decisions priority/2 medium This needs to be done
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants