SSH Shell v2 always return 0

Hello all,

I'm trying to figure out the correct usage of SSH Shell module. I can connect and execute commands, but even if the last command is non 0 return code ( in this case code 123 ) the module always return 0 and never fails.


I have these as commands... 

expect (.*\s*)*$
send mkdir /tmp/terraform_${run_id}
expect (.*\s*)*$
send cd /tmp/terraform_${run_id}
expect (.*\s*)*$
send git clone https://${terraform_git_user}:${terraform_git_token}@${terraform_git_url}/s .
expect (.*\s*)*$
send echo $?

I on purpose added /s on the end of git url to make it fail, and I can see it fail in the output ( I have added echo of last command to see the value, but the behavior is exactly the same without it) :

[terraform@_redacted_~]$ mkdir /tmp/terraform_113800184
[terraform@_redacted_~]$ cd /tmp/terraform_113800184
[terraform@_redacted_ terraform_113800184]$ git clone https://_redacted_:_redacted_@_redacted_/_redacted_/_redacted_.git/s .
Cloning into '.'...
echo $?
fatal: unable to update url base from redirection:
asked for: https://_redacted_:_redacted_@_redacted_/_redacted_/_redacted_.git/s/info/refs?service=git-upload-pack
redirect: https://_redacted_/login?return_to=https%3A%2F%2Fg_redacted_%2FMTCSC%2F_redacted_.git%2Fs%2Finfo%2Frefs%3Fservice%3Dgit-upload-pack
[terraform@_redacted_ terraform_113800184]$ echo $?
128
[terraform@_redacted_ terraform_113800184]$

It just never fails...