Include command output on error

Currently the logs produce

  TestOne: packetimpact_test.go:182: listing devices on ... container: process terminated with status: 126

which is not actionable; presumably the `ip` command output is interesting.

PiperOrigin-RevId: 329032105
This commit is contained in:
Tamir Duberstein 2020-08-28 16:43:24 -07:00 committed by gVisor bot
parent d5787f628c
commit d3057717dc
1 changed files with 2 additions and 2 deletions

View File

@ -369,11 +369,11 @@ func createDockerNetwork(ctx context.Context, n *dockerutil.Network) error {
func deviceByIP(ctx context.Context, d *dockerutil.Container, ip net.IP) (string, netdevs.DeviceInfo, error) {
out, err := d.Exec(ctx, dockerutil.ExecOpts{}, "ip", "addr", "show")
if err != nil {
return "", netdevs.DeviceInfo{}, fmt.Errorf("listing devices on %s container: %w", d.Name, err)
return "", netdevs.DeviceInfo{}, fmt.Errorf("listing devices on %s container: %w\n%s", d.Name, err, out)
}
devs, err := netdevs.ParseDevices(out)
if err != nil {
return "", netdevs.DeviceInfo{}, fmt.Errorf("parsing devices from %s container: %w", d.Name, err)
return "", netdevs.DeviceInfo{}, fmt.Errorf("parsing devices from %s container: %w\n%s", d.Name, err, out)
}
testDevice, deviceInfo, err := netdevs.FindDeviceByIP(ip, devs)
if err != nil {