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

Impossible to handle shell exceptions with shell(), #1022

Open
LadyCailinBot opened this issue Jan 25, 2015 · 1 comment
Open

Impossible to handle shell exceptions with shell(), #1022

LadyCailinBot opened this issue Jan 25, 2015 · 1 comment
Labels
bug Things that don't work as designed

Comments

@LadyCailinBot
Copy link

CMDHELPER-3020 - Reported by VergilPrime

So lets say I run a command in shell(). Lets say the code is shell(@command).

I run it, something's wrong so it errors. I see "ShellException" in console, but not much else.

I want to see what the problem is so I do @output = shell(@command); sys_out(@output) to check to see what's going on. The problem is, because shell threw ShellException, sys_out(@output) will never run.

So lets say I'm a super smart cookie and I do try(@output = shell(@command), sys_out(@output)) so that sys_out() runs when shell() fails. @output is still empy.

One last thing we can try, try(shell(@command),@exception,sys_out(@exception[1])).

This should work because @exception "... is set to an array containing the following information about the exception: ... 1 - The message generated by the exception..."

and shell() "... throws a ShellException with the exception message set to the syserr output if the process exits with an exit code that isn't the expectedExitCode..."

Upon running this code we find that @exception[1] is empty.

@LadyCailin
Copy link
Member

@VergilPrime Can you give an example of the shell command you were running? (I know, this was 5 years ago, so maybe you don't remember.)

@LadyCailin LadyCailin added the bug Things that don't work as designed label Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that don't work as designed
Projects
None yet
Development

No branches or pull requests

2 participants