I am sending a command to a server over ssh. The command may succeed or fail at the server.
I want to test for this, and on failure send a different command that will succeed.
So I grabbed this piece from the library example:
Sub SSH_CmdExecuted (Success As Boolean, Result AsList, TaskId As Int)
Log (TaskId)
If Success Then
For i=0To Result.Size-1
Log(Result.Get(i) & CRLF)
Next
EndIf
SSH2.close
End Sub
I inserted a "do something" in the "If Success" section (even just a msgbox for testing).
When the command is successful at the server, I get the msgbox as expected.
If the command fails I get no msgbox.
I want to do one thing upon success, something else upon failure.
I can't seem to use:
if not success
if success = 0
if success then
do something
else
do other thing
end if
Sub SSH_CmdExecuted (Success As Boolean, Failure as boolean, Result AsList, TaskId As Int)
The task I put after "If Success Then" works and seems to be dependent on the remote command's success. But I am not getting anything to happen in the CmdExecuted sub upon failure.
I intersperse msgboxes through this sub, and they show the sub is run either way. But I can't get anything to happen upon failure.
like this:
Sub SSH_CmdExecuted (Success As Boolean, Result AsList, TaskId As Int)
Log (TaskId)
Msgbox( "executed" ,2) <----this always displays
If Success Then
For i=0To Result.Size-1
Msgbox( Result.Get(i),1) <------ this displays when successful, with txt from server even.
Log(Result.Get(i) & CRLF)
Next
EndIf
SSH2.close
End Sub
Thanks for any insight into this!
Eric
PS: Stupid firefox won't let me insert code, I'm not ignoring the "how to post" etiquette.
I want to test for this, and on failure send a different command that will succeed.
So I grabbed this piece from the library example:
Sub SSH_CmdExecuted (Success As Boolean, Result AsList, TaskId As Int)
Log (TaskId)
If Success Then
For i=0To Result.Size-1
Log(Result.Get(i) & CRLF)
Next
EndIf
SSH2.close
End Sub
I inserted a "do something" in the "If Success" section (even just a msgbox for testing).
When the command is successful at the server, I get the msgbox as expected.
If the command fails I get no msgbox.
I want to do one thing upon success, something else upon failure.
I can't seem to use:
if not success
if success = 0
if success then
do something
else
do other thing
end if
Sub SSH_CmdExecuted (Success As Boolean, Failure as boolean, Result AsList, TaskId As Int)
The task I put after "If Success Then" works and seems to be dependent on the remote command's success. But I am not getting anything to happen in the CmdExecuted sub upon failure.
I intersperse msgboxes through this sub, and they show the sub is run either way. But I can't get anything to happen upon failure.
like this:
Sub SSH_CmdExecuted (Success As Boolean, Result AsList, TaskId As Int)
Log (TaskId)
Msgbox( "executed" ,2) <----this always displays
If Success Then
For i=0To Result.Size-1
Msgbox( Result.Get(i),1) <------ this displays when successful, with txt from server even.
Log(Result.Get(i) & CRLF)
Next
EndIf
SSH2.close
End Sub
Thanks for any insight into this!
Eric
PS: Stupid firefox won't let me insert code, I'm not ignoring the "how to post" etiquette.