Skip to content

Fix: Correct error handling pattern for Rust chmod command#8

Open
prjanitor wants to merge 1 commit into
slashexx:mainfrom
prjanitor:prjanitor/976a729728bf6506f76b546453696e9d96251fc0
Open

Fix: Correct error handling pattern for Rust chmod command#8
prjanitor wants to merge 1 commit into
slashexx:mainfrom
prjanitor:prjanitor/976a729728bf6506f76b546453696e9d96251fc0

Conversation

@prjanitor

Copy link
Copy Markdown

Bug Description

The chmod command in the Rust case had incorrect error handling. The code called execCmd.Run() first, then attempted to call execCmd.CombinedOutput() to retrieve error output. However, CombinedOutput() also executes the command - it cannot be called after Run() has already executed.

Fix

Changed the error handling pattern from:

if err := execCmd.Run(); err != nil {
    cmdOutput, _ := execCmd.CombinedOutput()
    return string(cmdOutput), err
}

To:

cmdOutput, err := execCmd.CombinedOutput()
if err != nil {
    return string(cmdOutput), err
}

This correctly uses CombinedOutput() which both executes the command and captures its output in a single call.

Impact

This fix ensures that chmod errors are properly captured and reported when compiling Rust code.


This PR was generated by PRJanitor — an automated tool that finds and fixes small bugs in open-source projects.

We respect your contribution guidelines — if your project doesn't accept bot PRs, we won't send more. You can also add a .github/prjanitor.yml file with enabled: false to opt out explicitly.

@vercel

vercel Bot commented Apr 4, 2026

Copy link
Copy Markdown

@prjanitor is attempting to deploy a commit to the slashexx's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant