-
Notifications
You must be signed in to change notification settings - Fork 232
Fix run_before_script()
output capturing
#959
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
Conversation
Reviewer's Guide by SourceryThis pull request modifies the run_before_script function to address excessive newlines in the output. It now captures stdout and stderr, and only prints to the terminal if it's a TTY. Additionally, it raises an exception if the script returns a non-zero exit code. Sequence diagram for improved run_before_script execution flowsequenceDiagram
participant C as Caller
participant R as run_before_script
participant S as Shell Script
participant T as Terminal
C->>R: Execute script
R->>S: Start process (Popen)
activate S
loop While script running
S-->>R: Read stdout line
alt is TTY
R->>T: Write to stdout
end
S-->>R: Read stderr line
alt is TTY
R->>T: Write to stderr
end
end
S-->>R: Return exit code
deactivate S
alt exit code != 0
R->>R: Raise BeforeLoadScriptError
end
R-->>C: Return exit code
Flow diagram for run_before_script error handlingflowchart TD
A[Start] --> B{Script exists?}
B -->|No| C[Raise BeforeLoadScriptNotExists]
B -->|Yes| D[Start process]
D --> E{Read output}
E --> F{Is TTY?}
F -->|Yes| G[Write to terminal]
F -->|No| H[Buffer output]
G --> I{Process finished?}
H --> I
I -->|No| E
I -->|Yes| J{Exit code = 0?}
J -->|Yes| K[Return exit code]
J -->|No| L[Raise BeforeLoadScriptError]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #959 +/- ##
==========================================
+ Coverage 72.92% 73.11% +0.18%
==========================================
Files 26 26
Lines 1843 1856 +13
Branches 350 352 +2
==========================================
+ Hits 1344 1357 +13
- Misses 394 395 +1
+ Partials 105 104 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @tony - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
10987af
to
03e6e68
Compare
run_before_script()
output capturing
tmuxp 1.52.0's before scripts print out a lot of newlines.
Summary by Sourcery
Bug Fixes: