-
Notifications
You must be signed in to change notification settings - Fork 78
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
Bash scripts return wrong exit codes on Windows #2783
Comments
Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support. |
Hey @cristiand391 thanks for your answer! Does this mean in my .sh scripts I can't somehow verify the command execution status? |
@oleg-mastriukov yeah, we've had a few reports like this when using git bash on windows, that's why officially support PowerShell on windows. Other native shells like Nushell work, but git-bash somehow doesn't play nice with sf. |
@cristiand391 thanks! I checked Nushell, but as I get it, it can't just run plain bash scripts so they need to be rewritten a little to match nu syntax. I don't think it's possible if other colleagues are working in the same repo and not having Nu installed. To conclude, there's no way to use plain bash scripts running sf/sfdx commands and verifying their status with the |
@oleg-mastriukov correct. The only way I see to run bash scripts would be through WSL. |
@cristiand391 my local community helped me find a solution for the issue:
This bash script works on Windows and returns proper exit codes. |
Summary
I'm adding if-then statement in my bash script to check the result of the execution:
The problem is that even though a scratch org is successfully created, the org_create_scratch_result variable equals 1 instead of 0:
Steps To Reproduce
Expected result
If a scratch org was successfully created with no errors, sf cli sets the $? variable to 0 after execution
Actual result
sf cli always sets the $? variable always to 1 after execution.
System Information
The text was updated successfully, but these errors were encountered: