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

x_man

script work fine, but WinSCP show Error with Error code 0

I run perl script as a Custom command (like this: perl -e '[script code]' !&)

And I got situation like this: script work fine, but WinSCP show Error window with some text and Error code 0.
I was confused!

...but after review [script code] I find some string like this "print STDERR $str" instead "print STDOUT $str" (for normal work!).


=> WinSCP show Error window just if you [script code] print STDERR!
...with any Return Error Code.
martin

Re: Adding new custom command parameter and apply error

I have corrected my answer. Note the 2>
dhall

Re: Adding new custom command parameter and apply error

martin wrote:

pstein wrote:

Maybe WinSCP can redirect the stderr output so that no error msg is shown.
The user should not be confused because of the error msg although the actual command was executed successfully.

Is this possible (in the next release)?

WinSCP should not do this implicitly, because for most commands output on stderr indicates an error. You can redirect the output explicitly:
dos2unix "!" "!" > /dev/null


Martin, I have tried your redirect solution several times, and I get the error message dialog displayed. You are correct that the files themselves are converted, but the Error is displayed as such:
Command 'dos2unix "16-JAN-14.TXT" "16-JAN-14.TXT" > /dev/null'failed with return code 0 and error message

dos2unix: converting file 16-JAN-14.TXT to UNIX format ...

Do you have any suggestions?
I am using version 4.3.5 (build 1463)
martin

Re: Adding new custom command parameter and apply error

pstein wrote:

Maybe WinSCP can redirect the stderr output so that no error msg is shown.
The user should not be confused because of the error msg although the actual command was executed successfully.

Is this possible (in the next release)?

WinSCP should not do this implicitly, because for most commands output on stderr indicates an error. You can redirect the output explicitly:
dos2unix "!" "!" 2> /dev/null
pstein

Re: Adding new custom command parameter and apply error

martin wrote:

pstein wrote:

Error executing custom command 'dos2unix "!" "!" on file 'dotest'.
Command 'dos2unix "dotest" "dotest"'
failed with return code 0 and error message
dos2unix: converting file dotest to UNIX format ...
dos2unix: converting file dotest to UNIX format ....

Because the dos2unix obviously prints its progress on error output. That's why WinSCP think it fails, although it does not.


Maybe WinSCP can redirect the stderr output so that no error msg is shown.
The user should not be confused because of the error msg although the actual command was executed successfully.

Is this possible (in the next release)?
martin

Re: Adding new custom command parameter and apply error

pstein wrote:

Error executing custom command 'dos2unix "!" "!" on file 'dotest'.
Command 'dos2unix "dotest" "dotest"'
failed with return code 0 and error message
dos2unix: converting file dotest to UNIX format ...
dos2unix: converting file dotest to UNIX format ....

Because the dos2unix obviously prints its progress on error output. That's why WinSCP think it fails, although it does not.
pstein

Re: Adding new custom command parameter and apply error

martin wrote:

The command is fine.
The prompt you are getting simply means that SFTP does not support executing shell commands. So WinSCP needs to open another shell session to perform the command.

What maybe confused you if term command. In the prompt is does not refer to your specific "dos2unix" command, but generally to "custom command" command/feature.


Hmm, I don't understand. If the "command is fine" as you said why is it failing? After applying it to a file I got an error popup:

Error executing custom command 'dos2unix "!" "!" on file 'dotest'.
Command 'dos2unix "dotest" "dotest"'
failed with return code 0 and error message
dos2unix: converting file dotest to UNIX format ...
dos2unix: converting file dotest to UNIX format ....

What's wrong?
martin

Re: Adding new custom command parameter and apply error

The command is fine.
The prompt you are getting simply means that SFTP does not support executing shell commands. So WinSCP needs to open another shell session to perform the command.

What maybe confused you if term command. In the prompt is does not refer to your specific "dos2unix" command, but generally to "custom command" command/feature.
pstein

Adding new custom command parameter and apply error

I want to add a new, own custom command

dos2unix <thisfile> <thisfile>

Obviously the CR/LF are replaced in-place by the unix style

What do I have to enter for <thisfile>?

Is this suitable:

dos2unix "!" "!"

?

When try to apply the command above to a certain file a dialog pops up telling me:

"Current SFTP-3 session does not support command you request. Separate shell session may be opened to process the command. Do you want to open separate shell session?"

Hm, why this?

I don't want another session. How can I achieve the execution of the dos2unix command in the current session otherwise?

Peter