imthekrish Respected Contributor.
Respected Contributor.
456 views

Return code SSH SHELL operation

I get return code 0 for both

echo $PATH and

eho$PATH

shouldnt i get non zero retiurn code for second command ?

0 Likes
1 Reply
AndreiTruta Outstanding Contributor.
Outstanding Contributor.

Re: Return code SSH SHELL operation

The behavior seems to match the code in behind.

I checked it on the open source cloudslang content available for you to check too here -https://github.com/CloudSlang/cs-actions/blob/5bc53aa9a8f83a4954ff4ce60c074713a8fc92d5/cs-ssh/src/main/java/io/cloudslang/content/ssh/services/actions/ScoreSSHShellCommand.java 

as long as the exit code is greater than 0 (in your case I quess it will be 127) the return code will be 0

        if (commandResult.getExitCode() >= 0) {
            returnResult.put(OutputNames.RETURN_RESULT, commandResult.getStandardOutput());
            returnResult.put(OutputNames.RETURN_CODE, ReturnCodes.SUCCESS);
        } else {
            returnResult.put(OutputNames.RETURN_RESULT, commandResult.getStandardError());
            returnResult.put(OutputNames.RETURN_CODE, ReturnCodes.FAILURE);
        }

If you are looking for a changed behavior I suggest to open a ticket according to the process so that the request will be properly prioritized and considered.

Hope it helps,

Andrei Vasile Truta
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.