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

sfdx force:* hangs when there's an error (no exit code returned) #239

Closed
bcattaneo opened this issue Aug 6, 2019 · 7 comments
Closed

sfdx force:* hangs when there's an error (no exit code returned) #239

bcattaneo opened this issue Aug 6, 2019 · 7 comments

Comments

@bcattaneo
Copy link

Summary

When there's an error in any of the force:* commands, process hangs forever without returning an exit code.

Steps To Reproduce:

  1. Run any force:* command forcing an error (E.g. sfdx force:org:list wrongparam or sfdx force:org:list --json wrongparam).

Expected result

Process exits returning a (negative) exit code.

Actual result

Process hangs forever, doesn't return an exit code.

Additional information

sfdx force:org:list wrongparam
sfdx_error_1

sfdx force:org:list --json wrongparam
sfdx_error_2

SFDX CLI Version(to find the version of the CLI engine run sfdx --version): sfdx-cli/7.18.0-ee5dc8194c win32-x64 node-v10.15.3

SFDX plugin Version(to find the version of the CLI plugin run sfdx plugins --core):

@oclif/plugin-commands 1.2.2 (core)
@oclif/plugin-help 2.2.0 (core)
@oclif/plugin-not-found 1.2.2 (core)
@oclif/plugin-plugins 1.7.8 (core)
@oclif/plugin-update 1.3.9 (core)
@oclif/plugin-warn-if-update-available 1.7.0 (core)
@oclif/plugin-which 1.0.3 (core)
@salesforce/sfdx-trust 3.0.5 (core)
analytics 1.2.0 (core)
generator 1.1.0 (core)
salesforcedx 46.8.0 (core)
├─ force-language-services 46.12.0 (core)
└─ salesforce-alm 46.11.0 (core)

sfdx-cli 7.18.0 (core)

OS and version: Windows 10

@bcattaneo
Copy link
Author

There's a cmdError event which apparently caughts some thrown exceptions on exit (with errors). File is: ...\sfdx\client\7.18.0-ee5dc8194c\node_modules@salesforce\plugin-analytics\lib\hooks\analyticsPrerun.js

After the exception is thrown, it never exits properly. Fixed it on my end adding the following:

// Log command errors to the server.  The ts-ignore is necessary
// because TS is strict about the events that can be handled on process.
// @ts-ignore
process.on('cmdError', async (cmdErr, flags = {}, org) => {
    try {

    }
    catch (err) {

    }
    process.exit(2); // Exit here. Probably needs a proper exit status and not a literal.
});

I hope that helps.

@BobSeu
Copy link

BobSeu commented Oct 3, 2019

Thanks for the temporary solution! I was running into this and it was getting pretty frustrating!

@BobSeu
Copy link

BobSeu commented Oct 11, 2019

Is there any update on when this bug might be fixed?

@clairebianchi
Copy link
Collaborator

@BobSeu We are unable to reproduce this issue. Can you please update to the most recent version of the CLI and try again. Also please report issues like these in the Generic CLI repo: https://github.com/forcedotcom/cli/issues

@clairebianchi clairebianchi transferred this issue from forcedotcom/sfdx-core Nov 15, 2019
@tnoonan-salesforce
Copy link

Also, did you try in a stock windows command.exe instance? Could it be related to Cmder?

@BobSeu
Copy link

BobSeu commented Dec 5, 2019

Sorry for the super delayed response. I think one of the later versions fixed this for me as I'm no longer having the issue. Thanks!

@bcattaneo
Copy link
Author

Hello. It did for me as well, thank you.
I'm closing this issue now.

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

No branches or pull requests

4 participants