+1 vote
by (130 points)

Using Rebex Components Legacy CF R5.1 on Win Compact 2013

I am trying to suppress the ssh prompt on certain inputs. The reason being, that some commands must go out to a different process and results are given back later on a different thread. In this scenario, I don't want the prompt to show again while the results come in.

I have tried to temporarily change prompt on the fly, but another question answered shows it is only settable before starting the server.

I have also tried setting the prompt to empty, and manually printing the prompt. However, an enter command from keyboard does not trigger the ShellCommand event, so I can't manually print it and it remains blank.

Is there any other way to go about doing this? I think being able to pick up the enter key from the keyboard would definitely be the easiest.

1 Answer

0 votes
by (147k points)

You are right about the prompt not being settable - it can be set even after the server starts, but once a shell is started, it retains the original prompt.

However, have you tried using ShellCommandEventArgs.Action to implement commands that give results later? The action is invoked in a background thread and no prompt is shown while it's running, so it looks like this might match your use case. See the second code snippet here for sample code (with e.Command == "hello").

by (130 points)
It is very close. The console clear does stop the prompt from being output while the result is fetched, which is correct. I would prefer the previous data being displayed though. If there is anyway to combine these two that would be the perfect fit.

Thanks for the direction lukas
by (147k points)
Have you tried removing the console.Clear() call? It's not actually required to hide the prompt, it's just a non-essential part of that particular sample code.
by (130 points)
Ok, I was able to get it to work correctly.

Is there a way that I can do a similar Action thing in the Authentication event? A similar thing is needed since again it has to be processed somewhere then returned if user/password is valid

Thanks for the help
by (147k points)
Sorry, this is not available for Authentication event yet. We plan to add it in a future version that introduces a fully asynchronous SSH core.
...