Repository navigation
changes StreamablePopen to return a process and implement listening - #229
Merged
mergify[bot] merged 1 commit intoSep 26, 2024
Merged
Conversation
JamesKunstle
force-pushed
the
fix-interruptable-subprocess
branch
from
September 26, 2024 16:42
66b5bf2 to
c89e08d
Compare
RobotSail
reviewed
Sep 26, 2024
| from copy import deepcopy | ||
| from pathlib import Path | ||
| import argparse | ||
| import logging |
Member
There was a problem hiding this comment.
Have you tested that this logging works? If I remember correctly, you need to initialize the logger first before it prints anything. Otherwise calling logging.xxx doesn't do anything.
Maxusmusti
requested changes
Sep 26, 2024
Collaborator
There was a problem hiding this comment.
Fix @RobotSail suggestion
JamesKunstle
force-pushed
the
fix-interruptable-subprocess
branch
2 times, most recently
from
September 26, 2024 19:12
2d24510 to
a081ce0
Compare
JamesKunstle
force-pushed
the
fix-interruptable-subprocess
branch
from
September 26, 2024 19:30
a081ce0 to
ef7e22a
Compare
JamesKunstle
force-pushed
the
fix-interruptable-subprocess
branch
from
September 26, 2024 19:53
ef7e22a to
8136e13
Compare
this corrects behavior: now, ctl-c (sigint) will be correctly handled by the subprocess handler. Signed-off-by: James Kunstle <jkunstle@redhat.com>
JamesKunstle
force-pushed
the
fix-interruptable-subprocess
branch
from
September 26, 2024 19:54
8136e13 to
5d1aee3
Compare
Contributor
Author
|
@Maxusmusti @RobotSail removed |
Member
|
Thanks! LGTM |
This was referenced Oct 1, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The original logic wasn't working because StreamablePopen started a process and then listened on the output file instead of returning a process that could be terminated/killed.
This adds 'process.listen' to implement the same behavior as before, but only after the StreamablePopen object has returned a reference to itself. When a KeyboardInterrupt is sent, the process can be terminated and/or killed, and the Exception/Interrupt can be raised.