Skip to content

t2857: Replace kill -0 with ps -p and remove redundant 2>/dev/null#2873

Closed
alex-solovyev wants to merge 1 commit intomainfrom
bugfix/t2857-stderr-suppression
Closed

t2857: Replace kill -0 with ps -p and remove redundant 2>/dev/null#2873
alex-solovyev wants to merge 1 commit intomainfrom
bugfix/t2857-stderr-suppression

Conversation

@alex-solovyev
Copy link
Collaborator

Summary

  • Replace all kill -0 $pid 2>/dev/null with ps -p $pid >/dev/null to avoid masking EPERM errors on process existence checks (4 instances)
  • Remove 2>/dev/null from cat after file existence check — the || echo fallback is sufficient and stderr should remain visible for debugging
  • Update inline comment referencing kill -0 to ps -p

Details

Addresses 3 medium findings from Gemini review on PR #2853, plus 2 additional instances of the same kill -0 2>/dev/null anti-pattern found in check_dedup().

Why ps -p over kill -0: kill -0 with 2>/dev/null suppresses all stderr, including EPERM errors that indicate the process exists but is owned by another user. ps -p with only stdout suppressed (>/dev/null) lets real errors through while still returning the correct exit code for process existence.

ShellCheck: zero violations.

Closes #2857

- Replace all kill -0 $pid 2>/dev/null with ps -p $pid >/dev/null to
  avoid masking EPERM errors on process existence checks (lines 122,
  138, 891, 900)
- Remove 2>/dev/null from cat after file existence check — the || echo
  fallback is sufficient and stderr should remain visible (line 1496)
- Update comment referencing kill -0 to ps -p (line 906)

ShellCheck: zero violations.

Closes #2857
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 5, 2026

Warning

Rate limit exceeded

@alex-solovyev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9fea33de-6917-4000-a370-901e38fbd644

📥 Commits

Reviewing files that changed from the base of the PR and between b18901f and 84194a9.

📒 Files selected for processing (1)
  • .agents/scripts/pulse-wrapper.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/t2857-stderr-suppression

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness and debuggability of shell scripts by refining how process existence is checked and how errors are handled. The changes prevent the suppression of critical error messages, particularly EPERM errors, which can obscure issues when processes are owned by different users. By making these adjustments, the scripts provide clearer diagnostic information without altering their intended functionality.

Highlights

  • Process Existence Checks: Replaced all instances of kill -0 $pid 2>/dev/null with ps -p $pid >/dev/null to prevent masking EPERM errors and improve error visibility during process existence checks.
  • Error Redirection Removal: Removed 2>/dev/null from cat commands where an || echo fallback was already present, ensuring stderr remains visible for debugging purposes.
  • Comment Updates: Updated inline comments to reflect the change from kill -0 to ps -p.
Changelog
  • .agents/scripts/pulse-wrapper.sh
    • Replaced kill -0 with ps -p for all process existence checks.
    • Removed 2>/dev/null from a cat command, relying on the || echo fallback.
    • Updated an inline comment to reference ps -p instead of kill -0.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Mar 5, 2026

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 107 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Thu Mar 5 02:54:33 UTC 2026: Code review monitoring started
Thu Mar 5 02:54:34 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 107

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 107
  • VULNERABILITIES: 0

Generated on: Thu Mar 5 02:54:37 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

@alex-solovyev
Copy link
Collaborator Author

Closing as duplicate of #2879, which covers the same fix with additional instances (4 code + 1 comment vs 3 code + 1 comment). PR #2879 is more complete and has better CI coverage. Issue #2857 will be resolved by #2879.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly replaces the less-robust kill -0 ... 2>/dev/null pattern with ps -p ... >/dev/null for checking process existence. This change is a good improvement as it avoids masking potential permission errors while still correctly checking if a process is running. Additionally, the removal of redundant error suppression on a cat command within a file existence check is also a good practice, improving debuggability. The changes are well-reasoned and correctly implemented across the pulse-wrapper.sh script.

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.

t1400: fix: pulse-wrapper.sh 2>/dev/null suppressions

1 participant