| 280 | } |
| 281 | |
| 282 | func (c *testContext) RequestCommandExecution(cmd string) { |
| 283 | t := c.T |
| 284 | t.Helper() |
| 285 | c.lock.Lock() |
| 286 | defer c.lock.Unlock() |
| 287 | if c.channel == nil { |
| 288 | t.Fatalf("No channel opened.") |
| 289 | } |
| 290 | t.Logf("Starting program %s ...", cmd) |
| 291 | |
| 292 | success, err := c.channel.SendRequest( |
| 293 | string(internalssh.RequestTypeExec), |
| 294 | true, |
| 295 | ssh.Marshal(internalssh.ExecRequestPayload{Exec: cmd}), |
| 296 | ) |
| 297 | if err != nil { |
| 298 | t.Fatalf("Failed to send exec request. (%v)", err) |
| 299 | } |
| 300 | if !success { |
| 301 | t.Fatalf("Server rejected exec request. (%v)", err) |
| 302 | } |
| 303 | t.Logf("Started program.") |
| 304 | } |
| 305 | |
| 306 | func (c *testContext) RequestShell() { |
| 307 | t := c.T |