Skip to content

Expect hangs with interactive command #31

Description

@ansiz

Program hangs when I try to execute Expect with unexpected string

child, err := gexpect.Spawn("passwd test")
if err != nil {
	log.Fatal(err)
}
err = child.Expect("YOU WILL NEVER FIND ME")
if err != nil {
	log.Println("should print error", err)  // should print error, but it never execute
}

I want to do this because there could be different results for one command. For example, ssh $hostname ls /tmp may output the directory information of tmp directly if the ssh public key has copied to the host, or get the prompt for the password, I found it only works well with non-interactive command.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions