Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Do not write json to stdout#99

Open
eric-wieser wants to merge 4 commits intoleanprover-community:masterfrom
eric-wieser:patch-3
Open

Do not write json to stdout#99
eric-wieser wants to merge 4 commits intoleanprover-community:masterfrom
eric-wieser:patch-3

Conversation

@eric-wieser
Copy link
Copy Markdown
Member

Otherwise it can't be used with projects that emit diagnostics

Otherwise it can't be used with projects that emit diagnostics
@eric-wieser
Copy link
Copy Markdown
Member Author

This worked fine in my own repository - any idea why it wouldn't be working fine here?

@gebner
Copy link
Copy Markdown
Member

gebner commented Nov 19, 2020

This worked fine in my own repository - any idea why it wouldn't be working fine here?

Unfortunately, we cannot use this for mathlib since string.to_char_buffer is excruciatingly slow. The easiest fix would be to add an io function to lean that can write a string (instead of a char_buffer).

@eric-wieser
Copy link
Copy Markdown
Member Author

eric-wieser commented Nov 19, 2020

So writing to stdout using a different mechanism to writing to a file handle? Edit: Ah, I get it now.

Comment thread src/export_json.lean Outdated
@gebner
Copy link
Copy Markdown
Member

gebner commented Nov 19, 2020

Unfortunately, put_str also converts to char_buffer under the hood.

@eric-wieser
Copy link
Copy Markdown
Member Author

Would chunking the conversion help here?

@eric-wieser
Copy link
Copy Markdown
Member Author

I worked around this downstream by just calling tail -n 1 export.json, which does the job of separating lean diagnostics from json output. It's ugly, but far easier that digging around in the lean IO internals

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants