-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from lpxxn/ssh-command
feat: ssh command
- Loading branch information
Showing
103 changed files
with
20,183 additions
and
264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,6 @@ doraemon | |
!doraemon/ | ||
# Dependency directories (remove the comment below to include it) | ||
!vendor/ | ||
.swn | ||
.swo | ||
.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package expect | ||
|
||
import ( | ||
"os" | ||
"os/exec" | ||
"testing" | ||
"time" | ||
|
||
"github.com/Netflix/go-expect" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestExpect1(t *testing.T) { | ||
c, err := expect.NewConsole(expect.WithStdout(os.Stdout)) | ||
assert.Nil(t, err) | ||
cmd := exec.Command("vi", "a.txt") | ||
cmd.Stdin = c.Tty() | ||
cmd.Stdout = c.Tty() | ||
cmd.Stderr = c.Tty() | ||
go func() { | ||
rev, err := c.ExpectString("hello world") | ||
assert.Nil(t, err) | ||
t.Log(rev) | ||
}() | ||
err = cmd.Start() | ||
assert.Nil(t, err) | ||
time.Sleep(time.Second) | ||
c.Send("ihello world") | ||
time.Sleep(time.Second) | ||
c.Send("dd") | ||
time.Sleep(time.Second) | ||
c.SendLine(":q!") | ||
|
||
err = cmd.Wait() | ||
assert.Nil(t, err) | ||
time.Sleep(time.Second * 10) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.