Topic "Failed with return code 0?"

Author Message
mambojuice
[View user's profile]

Joined: 2013-12-23
Posts: 2
Hi all, sorry if this has already been asked but I wasn't able to find anything relevant by searching the forum...

I have a powershell script that uses the .NET assembly to manipulate some RHEL Linux servers. When sending a WGET command, the command exits cleanly but WinSCP reports an error. It doesn't matter what file I am downloading.

Code:

Exception calling "ExecuteCommand" with "1" argument(s): "Command 'wget http://intranet/filename.xyz'
failed with return code 0 and error message

--2013-12-23 20:11:11--  http://intranet/filename.xyz
Resolving intranet... 192.168.1.100
Connecting to intranet|192.168.1.100|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7136 (7.0K) [text/plain]
Saving to: filename.xyz

     0K ......                                                100% 14.7M=0s

2013-12-23 20:11:11 (14.7 MB/s) - filename.xyz saved [7136/7136]."


Return code 0 indicates to me that all was successful. The files do in fact download as expected. I suspect wget is doing something silly like writing to StdErr as well as StdOut.

Is there any way to gracefully handle this exception and continue? Maybe some way to check what the error code was and ignore if it is 0?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Yes, it's error output that causes this. Just suppress it:
wget ... 2> /dev/null
_________________
Martin Prikryl
mambojuice
[View user's profile]

Joined: 2013-12-23
Posts: 2
Thanks, that seems to work. Hopefully it won't repress any actual failures.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License