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

Do not write json to stdout #99

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

eric-wieser
Copy link
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
Member Author

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

@gebner
Copy link
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
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.

src/export_json.lean Outdated Show resolved Hide resolved
@gebner
Copy link
Member

gebner commented Nov 19, 2020

Unfortunately, put_str also converts to char_buffer under the hood.

@eric-wieser
Copy link
Member Author

Would chunking the conversion help here?

@eric-wieser
Copy link
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants