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

Unrecognised commands yields exit code 0 #2789

Closed
geoffswift opened this issue Mar 22, 2024 · 3 comments
Closed

Unrecognised commands yields exit code 0 #2789

geoffswift opened this issue Mar 22, 2024 · 3 comments
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated

Comments

@geoffswift
Copy link

geoffswift commented Mar 22, 2024

Summary

If I give sf a bogus command, it reports success exit code 0.

Steps To Reproduce

$ sf invalid < /dev/null; echo "Exit code: $?"
 ›   Warning: invalid is not a sf command.
Did you mean env list? [y/n]: Exit code: 0

Expected result

I expect a non-zero exitcode to indicate a failure, e.g. since I have a typo for the command name in my script.

Actual result

The command purports to have succeeded. This is not ideal for example in a CI environment, as it may be considered a false positive.

System Information

{
  "architecture": "darwin-arm64",
  "cliVersion": "@salesforce/cli/2.33.3",
  "nodeVersion": "node-v18.19.1",
  "osVersion": "Darwin 23.4.0",
  "rootPath": "/Users/XXX/node_modules/@salesforce/cli",
  "shell": "bash",
  "pluginVersions": [
    "@oclif/plugin-autocomplete 3.0.13 (core)",
    "@oclif/plugin-commands 3.2.0 (core)",
    "@oclif/plugin-help 6.0.18 (core)",
    "@oclif/plugin-not-found 3.0.14 (core)",
    "@oclif/plugin-plugins 4.3.5 (core)",
    "@oclif/plugin-search 1.0.20 (core)",
    "@oclif/plugin-update 4.2.0 (core)",
    "@oclif/plugin-version 2.0.14 (core)",
    "@oclif/plugin-warn-if-update-available 3.0.14 (core)",
    "@oclif/plugin-which 3.1.4 (core)",
    "@salesforce/analytics 1.4.8 (link) /Users/XXX/node_modules/@salesforce/analytics",
    "@salesforce/cli 2.33.3 (core)",
    "apex 3.0.30 (core)",
    "auth 3.3.23 (core)",
    "community 3.0.27 (link) /Users/XXX/node_modules/@salesforce/plugin-community",
    "data 3.1.9 (core)",
    "deploy-retrieve 3.2.31 (core)",
    "info 3.0.31 (core)",
    "limits 3.1.13 (core)",
    "marketplace 1.0.27 (core)",
    "org 3.4.3 (core)",
    "packaging 2.1.12 (core)",
    "schema 3.1.7 (core)",
    "settings 2.0.31 (core)",
    "sobject 1.1.18 (core)",
    "source 3.1.20 (core)",
    "telemetry 3.1.16 (core)",
    "templates 56.0.21 (core)",
    "trust 3.3.16 (core)",
    "user 3.3.3 (core)"
  ]
}
@geoffswift geoffswift added the investigating We're actively investigating this issue label Mar 22, 2024
Copy link

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.

@github-actions github-actions bot added the validated Version information for this issue has been validated label Mar 22, 2024
@daveespo
Copy link

I called this out on #2739 -- the behavior is different in a TTY environment from a non-TTY environment. In a TTY environment, you get a nonzero exit code .. but a non-TTY environment it's 0

Agreed it sounds like a bug but it's been like this forever so it would be a breaking change.

@cristiand391
Copy link
Member

Thanks for linking it, David.
Closing as dup

@cristiand391 cristiand391 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue validated Version information for this issue has been validated
Projects
None yet
Development

No branches or pull requests

3 participants