Skip to content

Commit 9b8eb1c

Browse files
authored
Fix AgentExec when no pid returned (luthermonson#141)
1 parent 6c73285 commit 9b8eb1c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

virtual_machine.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,12 @@ func (v *VirtualMachine) AgentExec(ctx context.Context, command []string, inputD
509509
"input-data": inputData,
510510
},
511511
&tmpdata)
512-
pid = int(tmpdata["pid"].(float64))
512+
513+
p := tmpdata["pid"]
514+
if p == nil {
515+
return 0, fmt.Errorf("no pid returned from agent exec command")
516+
}
517+
pid = int(p.(float64))
513518
return
514519
}
515520

0 commit comments

Comments
 (0)