# SSH Execute Command not failed on unexpected exit status

**URL:** https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560
**Category:** Bugs
**Created:** [May 13, 2015, 6:39am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560 "2015-05-13T06:39:40Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![freji.kailaku](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/f/e19b73/32.png) [@freji.kailaku](https://www.finalbuilder.com/forums/u/freji.kailaku)
#### Post date: [May 13, 2015, 6:39am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/1 "2015-05-13T06:39:40Z")

</div>

- FinalBuilder Version: 7.0.0.3319
- Windows Version: Windows Server 2012 R2 Standard
- Linux Version: CentOS 6.4

I have an SSH execute command action that execute perl script on CentOS Linux server. The perl script returned with exit code 0 when successful and other positive integers when error occurs.  
Hence I configured the action with Expected Exit Status = 0 and Fail on Unexpected Status = True.  
However when the script returns 1 or other integers the action still considered as successful.   
I can see in the log a line reporting the exit status and the last line says :Attempting to get exit code of last command."  
Looks like a bug to me, the "Fail on Unexpected Status" option doesn't seem to be doing what it says it should. Although I noticed that this option is not explained in the Help guide.  
  
/Freji

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [May 15, 2015, 12:20pm UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/2 "2015-05-15T12:20:23Z")

</div>

We’ll look into this, I know when Jason was working on this a while back it’s not easy to achieve but it was working. What shell did you specify on the action?

---

<div class="post-metadata">

### Author: ![freji.kailaku](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/f/e19b73/32.png) [@freji.kailaku](https://www.finalbuilder.com/forums/u/freji.kailaku)
#### Post date: [May 18, 2015, 11:22am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/3 "2015-05-18T11:22:26Z")

</div>

Hi Vincent,   
  
 I tried running perl and shell script, both same behavior. Just have a single line with exit code other than 0 in the script. The command is always considered as exit with 0.   
  
 /Freji

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [May 19, 2015, 1:16am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/4 "2015-05-19T01:16:55Z")

</div>

On your SSH Connect action, what shell type is selected?

---

<div class="post-metadata">

### Author: ![freji.kailaku](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/f/e19b73/32.png) [@freji.kailaku](https://www.finalbuilder.com/forums/u/freji.kailaku)
#### Post date: [May 19, 2015, 4:17am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/5 "2015-05-19T04:17:05Z")

</div>

Hi Vincent,   
  
 I have tried different shell types with same result.   
  
 /Freji

---

<div class="post-metadata">

### Author: ![nevar](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/c4cdca/32.png) [@nevar](https://www.finalbuilder.com/forums/u/nevar)
#### Post date: [May 19, 2015, 4:39am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/6 "2015-05-19T04:39:32Z")

</div>

Hi Freji,   
  
 Would you be able to send us a short Perl script which simulates the returning of the exit code of 1. The reason I ask for this is to confirm that I am testing exactly what your experiencing.   
  
 Thank you.

---

<div class="post-metadata">

### Author: ![freji.kailaku](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/f/e19b73/32.png) [@freji.kailaku](https://www.finalbuilder.com/forums/u/freji.kailaku)
#### Post date: [May 19, 2015, 5:06am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/7 "2015-05-19T05:06:49Z")

</div>

Hi Jason,   
  
 The perl script contains only the following lines:   
 --------------------------------------   
 #!/usr/bin/perl -w   
  
 print “test run\n”;   
 exit 1;   
 --------------------------------------

---

<div class="post-metadata">

### Author: ![nevar](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/n/c4cdca/32.png) [@nevar](https://www.finalbuilder.com/forums/u/nevar)
#### Post date: [May 20, 2015, 7:50am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/8 "2015-05-20T07:50:48Z")

</div>

Hi Freji,   
  
 Please find an updated build located here:   
  
 [http://downloads.finalbuilder.com/downloads/finalbuilder/700/FB700\_3322.exe](http://downloads.finalbuilder.com/downloads/finalbuilder/700/FB700_3322.exe)   
  
 Please let us know if this addresses the issues your seeing. The build has passed the test cases we have developed based on your report.

---

<div class="post-metadata">

### Author: ![freji.kailaku](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/f/e19b73/32.png) [@freji.kailaku](https://www.finalbuilder.com/forums/u/freji.kailaku)
#### Post date: [May 22, 2015, 9:08am UTC](https://www.finalbuilder.com/forums/t/ssh-execute-command-not-failed-on-unexpected-exit-status/3560/9 "2015-05-22T09:08:35Z")

</div>

Hi Jason,   
  
 I have installed the new build and it looks like it’s working as expected now.   
  
 Thank you so much!   
  
 /Freji
