Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

tperk

I agree that most programs only write to stderr when there is an error, but it is also common practice to write warnings to stderr. So I would argue that proper execution is indicated solely by the exit code.

Also for your consideration: what if you want to test the result of a command?

call if cmd1 ; then cmd2 ; fi


If cmd1 writes to stderr then the user needs to start putting redirects everywhere.

Maybe I'm being unreasonable, and I should put stuff like this in a bash script instead of writing one-liners. I was just expecting "option batch abort" to be analogous to "set -e".

Anyway, thank you Martin.
martin

Re: script fails with return code 0

Well, I believe it is perfectly correct to check the error output. And you can always wouraround that the way you did (by redirecting to stardard output).
tperk

script fails with return code 0

Using WinSCP 4.3.5 (Build 1463) on Windows XP SP3. I'm using the command line version.

WinSCP can falsely detect errors in the call command when the return code is 0. If the return code 0, then there should be no error. This is demonstrated below:

winscp> option echo off

echo            off       
winscp> option bat abort
batch           abort     
winscp> option confirm off
confirm         off       
winscp> option transfer automatic
transfer        automatic
winscp> open -timeout=1 root:FM@192.168.101.2
Searching for host...
Connecting to host...
Authenticating...
Using username \"root\".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
Active session: [1] root@192.168.101.2
winscp> call echo "asdf" >&2
Searching for host...
Connecting to host...
Authenticating...
Using username \"root\".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Reading remote directory...
Session started.
asdf
Command 'echo "asdf" >&2'
failed with return code 0 and error message
asdf.


This doesn't happen if I use stdout instead of stderr. So I'm guessing WinSCP is checking stderr when it should only be checking the return code.

Keep up the good work, your software is really useful! Thank you.