Error in "call" does not abort the script
Hi,
I'm using a script to upload a zip file, unzip it, and delete the zip file - all through an SFTP connection.
I noticed that the script does not abort if the call to the unzip command fails.
I would expect that the script below would abort because of the "call false" and will never execute the "call echo ..." command.
However, the script continues regardless of the failure of the first "call" command.
From the log file, it is clear that WinSCP.com recieves the error status of the failing "call":
Is there a way to abort the script after a call fails?
Thanks!
I'm using a script to upload a zip file, unzip it, and delete the zip file - all through an SFTP connection.
I noticed that the script does not abort if the call to the unzip command fails.
I would expect that the script below would abort because of the "call false" and will never execute the "call echo ..." command.
open some_sftp_site.org call false call echo WinSCP did not abort exit
From the log file, it is clear that WinSCP.com recieves the error status of the failing "call":
< 2015-08-04 07:27:06.066 Script: Session started. . 2015-08-04 07:27:06.067 Executing user defined command on command session. > 2015-08-04 07:27:06.067 [Shell] false ; echo "WinSCP: this is end-of-file:$?" < 2015-08-04 07:27:06.138 [Shell] WinSCP: this is end-of-file:1 > 2015-08-04 07:27:06.138 [Shell] pwd ; echo "WinSCP: this is end-of-file:$?" < 2015-08-04 07:27:06.210 [Shell] /home/osm < 2015-08-04 07:27:06.210 [Shell] WinSCP: this is end-of-file:0 . 2015-08-04 07:27:06.210 Cached directory change via "/home/osm" to "/home/osm". . 2015-08-04 07:27:06.210 Getting current directory name. . 2015-08-04 07:27:06.210 Getting current directory name. > 2015-08-04 07:27:06.211 Script: call echo WinSCP did not abort . 2015-08-04 07:27:06.211 Executing user defined command on command session. > 2015-08-04 07:27:06.211 [Shell] echo WinSCP did not abort ; echo "WinSCP: this is end-of-file:$?" < 2015-08-04 07:27:06.283 Script: WinSCP did not abort < 2015-08-04 07:27:06.283 [Shell] WinSCP did not abort < 2015-08-04 07:27:06.283 [Shell] WinSCP: this is end-of-file:0
Thanks!