Skip to content

Cannot write to stdin after command execution #439

Closed
@adam3039

Description

@adam3039

I'm trying to run a program that requires an input to select which module within the program to run. I can connect fine, and I can run the program, but I seem to be having zero luck writing to the shellstream I am creating. I've gone through every issue ticket regarding this, and most of the solutions make it seem super simple, but nothing is working for me.

using (var client = new SshClient("10.0.0.136", "ubuntu", "ubuntu"))
{
       client.Connect();
       var runCommand = client.CreateCommand("cd Documents/OnboardSDK/build/bin; ./sample-program");

       var result = runCommand.BeginExecute();
       var reader = new StreamReader(runCommand.OutputStream);
       Console.WriteLine(reader.ReadToEnd());
                
       var stream = client.CreateShellStream("term", 80, 24, 800, 600, 1024);
       stream.WriteLine("a");

       client.Disconnect();
}

I get the output of the program up until where the stdin should be, but writing to the stream isn't causing the program to continue. "a" is the option I am picking, and in a putty session all I need to do is type a and hit the enter key for the program to continue.

Any insight is greatly appreciated, I am new to this library. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions