This project is read-only.

ShellStream to execute a command, which requires confirmation "YES"

Jun 9, 2014 at 8:37 AM
We are writing a tool to automate the operation to HP OA. It works perfectly unless we meet a command which requires confirmation during its execution. It output "Do you want to continue ? " and we have to type "YES" to continue. We want to do this in our code. But with the following code it usually return "Operation terminated by user" after writing "YES".
                ShellStream ss = oar.Connection.CreateShellStream("", 100, 100, 100, 100, 9999);
                        StreamReader reader = new StreamReader(ss);
                        StreamWriter writer = new StreamWriter(ss);
                        writer.AutoFlush = true;

                           writer.WriteLine(isshcmdrecord.Command);
                            while (pollTime < isshcmdrecord.PollTime)
                            {
                                System.Threading.Thread.Sleep(3000);
                                buf = reader.ReadToEnd();
                                if (buf != "")
                                {                                    
                                    result += buf;
                                   foreach (KeyValuePair<string, string> kp in isshcmdrecord.PromptStringsAndInputs)
                                        {
                                            if (buf.Contains(kp.Key))
                                            {                                                    
                                                ss.WriteLine(kp.Value);     __//here we write "YES", but it usually return "Operation terminated by user", we tried use Write() instead of "WriteLine". In putty or telnet session, we got this message if simply hit ENTER.  __                                          
                                                break;
                                            }
                                        }
                                    }
                                  }
does any see similar issue? How can I solve this issue? Thanks for any help
Jun 10, 2014 at 12:43 AM
Or the question is how to use the library to support interactive commands? did anyone run into this issue before?
Jun 10, 2014 at 8:53 AM
It seems that we have the issue with 2014.4.6-beta1 version(the latest available download binary and the Change Set: 35216).
It works fine with the latest source code (sshnet-35920). Maybe it's fixed in the latest code.
Jun 13, 2014 at 7:56 PM
There was a fix in this area in 2014.4.6-beta1:
https://sshnet.codeplex.com/workitem/1584

Since then there were no changes in this area at all.