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

Error with pipe in jq but not error if I first redirect output to a file #3201

Open
mmm286 opened this issue Nov 11, 2024 · 4 comments
Open
Labels

Comments

@mmm286
Copy link

mmm286 commented Nov 11, 2024

Hi,
I'm trying to do a pipe with jq to parser an api output and it gives me error:

ctm run jobs:status::get -s "status=Ended Not OK" | jq '.returned'
parse error: Unfinished string at EOF at line 2072, column 57

However if I redirect to a file I don't have any problem:

ctm run jobs:status::get -s "status=Ended Not OK" > errors
cat errors | jq '.returned'
361

Thanks

@wader
Copy link
Member

wader commented Nov 11, 2024

Does ... | tee errors | jq also fail? if so could you post the whole or part of the errors file?

@mmm286
Copy link
Author

mmm286 commented Nov 11, 2024

Does ... | tee errors | jq also fail? if so could you post the whole or part of the errors file?

ctm run jobs:status::get -s "status=Ended Not OK" | tee errors | jq '.'
parse error: Unfinished string at EOF at line 2069, column 37

@wader
Copy link
Member

wader commented Nov 11, 2024

And how does the errors file look like? judging by the error message it seems like the file ends in the middle of a quoted string. If so i would guess the problem happens before jq, ex ctm for some reason behaving different when stdout is a file or pipe (buffer issues?), broken disk?

@wader
Copy link
Member

wader commented Nov 13, 2024

@mmm286 did figure it out? close issue?

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

No branches or pull requests

3 participants