Skip to content
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

fix(bash): improve bash last line as result reliability using bash process substitution #5321

Merged
merged 2 commits into from
Feb 18, 2025

Conversation

rubenfiszel
Copy link
Contributor

@rubenfiszel rubenfiszel commented Feb 18, 2025

Important

Improves bash script output reliability by using process substitution instead of named pipes in bash_executor.rs.

  • Behavior:
    • Replaces named pipe with process substitution in bash_executor.rs for capturing the last line of output in bash scripts.
    • Updates wrapper.sh and wrapper.ps1 to use process substitution for output redirection.
  • Error Handling:
    • Adds 2>/dev/null || true to pkill command to suppress errors if no process is found.
  • Misc:
    • Removes creation and deletion of named pipe bp in bash_executor.rs.

This description was created by Ellipsis for 00304e5. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to aeaf991 in 49 seconds

More details
  • Looked at 37 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. backend/windmill-worker/src/bash_executor.rs:110
  • Draft comment:
    Using process substitution here simplifies the pipe logic by removing the named pipe. However, note that tee in a pipeline returns the exit status of the last command. Verify that the exit code from main.sh is propagated as expected when using process substitution.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
2. backend/windmill-worker/src/bash_executor.rs:617
  • Draft comment:
    The wrapper for PowerShell now uses process substitution. Ensure that the target environments consistently support this feature and that it correctly captures the last line of output from main.ps1.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
3. backend/windmill-worker/src/bash_executor.rs:110
  • Draft comment:
    Using process substitution (tee >(tail -1 >> ./result2.out)) removes the need for a named pipe. Please ensure that the specified bash ($BIN_BASH) supports process substitution in all target environments.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
4. backend/windmill-worker/src/bash_executor.rs:624
  • Draft comment:
    Wrapper.sh for the PowerShell job now uses process substitution as well. Confirm that this change behaves correctly in your deployment, as it eliminates the mkfifo and associated cleanup.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None

Workflow ID: wflow_j4hhclc8tp3vjkbX


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

cloudflare-workers-and-pages bot commented Feb 18, 2025

Deploying windmill with  Cloudflare Pages  Cloudflare Pages

Latest commit: 00304e5
Status:⚡️  Build in progress...

View logs

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 00304e5 in 33 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. backend/windmill-worker/src/bash_executor.rs:100
  • Draft comment:
    Good improvement. Adding redirection and fallback prevents error output if pkill fails to find processes.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
2. backend/windmill-worker/src/bash_executor.rs:100
  • Draft comment:
    Using '|| true' with stderr redirection prevents the script from failing (due to set -e) when no child processes are found. Consider also redirecting stdout if any unwanted output might occur.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None

Workflow ID: wflow_V8lBhqp1DQ6G5rgd


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@rubenfiszel rubenfiszel merged commit 138cedf into main Feb 18, 2025
6 of 7 checks passed
@rubenfiszel rubenfiszel deleted the rf/improveBash branch February 18, 2025 14:13
@github-actions github-actions bot locked and limited conversation to collaborators Feb 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant