-
Notifications
You must be signed in to change notification settings - Fork 40
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
stderr not displayed if using a non-interactive terminal #684
Comments
Related: Here is @sourishkrout 's comment
@sourishkrout what's a panel here? Are you referring to how an outputitem gets rendered in the vscode notebook?
How does this compare to the following a) Use a single OutputItem with mimetype application/vnd.code.notebook.stdout but the contents are actually stdout & stderr |
When I say "panel" I mean the vscode-integrated terminal in the bottom panels (see screenshot below) where we'are already multiplexing interactive cell's stdout/stderr. The current impl forgoes this for non-interactive because we didn't think we needed it then.
The solution I'm favoring (still open) is to have the 1.) OutputItem only receive
While not impossible, I believe it might be difficult to follow unless you have more than average knowledge about stdio. However, both approaches aren't mutually exclusive and could be combined. |
Case-in-point for notebook/vscode terminal multiplexing is that interactive cells, if you focus/open the integrated terminals, will currently auto-close the bottom panel upon successful completion. This is due to |
Let me see if I understand correctly.
I don't think I appreciated all the subtleties here; thank you for the detailed explanation. I don't love the idea of having to look at the vscode integrated terminal in the bottom panel to see stderr for non-interactive cells. Apriori, my expectation for notebooks is that errors should appear in the cell outputs (i.e. that's how it would work if I ran it jupyter or vscode with ipython kernel). One takeway from this discussion is that for Foyle, I should go back to returning interactive cells by default so that stderr shows up by default. Users can then explicitly switch to non-interactive for other renderers. This also means I need to ensure completions are properly triggered for interactive cells. |
Correct. This is how I propose the notebook terminals should work by default. The existing implementation is more obscure and unintentional, and I've been unhappy with it for a while now.
No sweat. Unless you really "have to care," one only sees the tip of the iceberg, that's stdio + char devices.
Ultimately, we likely want both, errors in the integrated and notebook terminals. The latter involves a non-trivial amount of UX/UI work, which I'd like to defer in favor of a short-term fix that's low-hanging fruit. I am currently working on a branch to get this done.
I'd strongly suggest always defaulting to interactive, especially for shell scripts. Even simple commands aren't always TTY-aware and might block execution awaiting user input. For better non-interactive UX, the notebook cell should offer a button when applicable to rerun the cell switched to non-interactive when it detects a non-plain-text media type. |
I got it roughly working below, @jlewi. Since we benefit from a PTY/TTY, I'm emitting |
There is some cleanup to do, but this matches above's summary: Stdio.mp4 |
This is fixed as per stateful/vscode-runme#1763, and the follow-up issue was created stateful/vscode-runme#1831. |
As a workaround for jlewi/foyle#286 I started configuring code cells to run in a non-interactive terminal. When I do this, I notice that errors (I think stderror) don't show up.
Here's a video. In this video I'm running a gcloud command that should return an error because the command line argument is incorrect.
runme-no-error-non-interactive.mp4
I'm pretty sure gcloud is writing errors to standard error and not stdout because we can do the following to redirect the error in this case to a file.
Here's the notebook
https://gist.github.com/jlewi/d339af225bb4de94ca0845c342c421e0
If I explicitly redirect stderr to stdout as in the command below then the error will show up in the notebook.
Is this working as intended? As a user, my expectation would be that stdout and stderr would both show up by default just as they would in a terminal.
For Foyle, its important that we capture stderr because we'd like the AI to make suggestions to fix the error. Since a cell can have multiple output-items one option would be to store stdout and stderr as separate items. Foyle could then figure out how to process them.
The text was updated successfully, but these errors were encountered: