-
-
Notifications
You must be signed in to change notification settings - Fork 369
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
Try to capture all filedescriptor output and err #630
Merged
Merged
Commits on Apr 13, 2021
-
Try to capture stdout and err going directly to 1/2 filedescriptor.
This try to fix a long standing issue that stdout and stderr going directly to the filedescriptor are not shown in notebooks. This is annoying when using wrappers around c-libraries, or calling system commands as those will not be seen from within notebook. Here we redirect and split the filedescriptor and watch those in threads and redirect both to the original FD (terminal), and ZMQ (notebook). Thus output sent to fd 1 & 2 will be shown BOTH in terminal that launched the notebook server and in notebook themselves. One of the concern is that now logs and errors internal to ipykernel may appear in the notebook themselves, so may confuse user; though these should be limited to error and debug; and we can workaround this by setting the log handler to not be stdout/err. This still seem like a big hack to me, and I don't like thread. I did not manage to make reading the FD non-blocking; so this cannot be put in the io-thread – at least I'm not sure how. So adds 2 extra threads to the kernel. This might need to be turn off by default for now until further testing. Locally this seem to work with things like: - os.system("echo HELLO WORLD") - c-extensions writing directly to fd 1 and 2 (when properly flushed). I have no clue how filedescriptor work on windows, so this only change behavior on linux and mac.
Configuration menu - View commit details
-
Copy full SHA for ae2f441 - Browse repository at this point
Copy the full SHA ae2f441View commit details -
Modify all log handlers to route messages directly screen.
Bypass the original fd 2 for stderr, and use the new piped one.
Configuration menu - View commit details
-
Copy full SHA for f1b8a56 - Browse repository at this point
Copy the full SHA f1b8a56View commit details -
Configuration menu - View commit details
-
Copy full SHA for 799722e - Browse repository at this point
Copy the full SHA 799722eView commit details -
Make sure replaced streams have fileno.
This is important for example for subprocess that will peak at the filedescriptor.
Configuration menu - View commit details
-
Copy full SHA for 12c8ece - Browse repository at this point
Copy the full SHA 12c8eceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 310f0cd - Browse repository at this point
Copy the full SHA 310f0cdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 192fc6c - Browse repository at this point
Copy the full SHA 192fc6cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 79496f0 - Browse repository at this point
Copy the full SHA 79496f0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8a160a5 - Browse repository at this point
Copy the full SHA 8a160a5View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.