Skip to content

Commit

Permalink
Merge pull request #98 from Jlan45/main
Browse files Browse the repository at this point in the history
Fix the bug that AgentExec didn't return right pid number
  • Loading branch information
luthermonson authored Oct 25, 2023
2 parents 06ff644 + f3f470a commit 413ae35
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,13 +491,14 @@ func (v *VirtualMachine) WaitForAgent(seconds int) error {
}

func (v *VirtualMachine) AgentExec(command, inputData string) (pid int, err error) {
tmpdata := map[string]interface{}{}
err = v.client.Post(fmt.Sprintf("/nodes/%s/qemu/%d/agent/exec", v.Node, v.VMID),
map[string]string{
"command": command,
"input-data": inputData,
},
&pid)

&tmpdata)
pid = int(tmpdata["pid"].(float64))
return
}

Expand Down

0 comments on commit 413ae35

Please sign in to comment.