Skip to content

Expect reads and returns data out of order #444

Closed
@viralmutant

Description

@viralmutant

I have a test script which write a command to host and then immediately reads it to ensure that command was executed

// Writing data
SshShellStream.Write(command + "\n");
SshShellStream.Flush();
// Reading what was written
bool rc = SshShellStream.Expect(regex, timeout == null ? TimeSpan.FromMinutes(30) : (TimeSpan)timeout, out result);
if (!rc)
{
string msg = "Ssh shell Expect time out! " + result;
LogEvents.OnDebug(msg);
throw new Exception(msg);
}

The code throws exception occasionally and the result is printed as
System.Exception: Ssh shell Expect time out! sharsysadmin@my-local-host# e dest

The output expected was
sysadmin@my-local-host# share destroy

Which is same as what was returned, but was out of order

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