Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5380690 commit 85329a2Copy full SHA for 85329a2
cli/ssh_test.go
@@ -1219,8 +1219,10 @@ func TestSSH(t *testing.T) {
1219
// started and accepting input on stdin.
1220
_ = pty.Peek(ctx, 1)
1221
1222
- pty.WriteLine(fmt.Sprintf("netstat -an | grep -q %s; echo \"returned $?\"", remoteSock))
1223
- pty.ExpectMatchContext(ctx, "returned 0")
+ // This needs to support most shells on Linux or macOS
+ // We can't include exactly what's expected in the input, as that will always be matched
1224
+ pty.WriteLine(fmt.Sprintf(`echo "results: $(netstat -an | grep %s | wc -l | tr -d ' ')"`, remoteSock))
1225
+ pty.ExpectMatchContext(ctx, "results: 1")
1226
1227
// And we're done.
1228
pty.WriteLine("exit")
0 commit comments