Skip to content

Commit

Permalink
Fix the bug that AgentExec didn't return right pid number
Browse files Browse the repository at this point in the history
  • Loading branch information
Jlan45 committed Oct 25, 2023
1 parent 06ff644 commit f3f470a
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{}{}

Check warning on line 494 in virtual_machine.go

View check run for this annotation

Codecov / codecov/patch

virtual_machine.go#L494

Added line #L494 was not covered by tests
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))

Check warning on line 501 in virtual_machine.go

View check run for this annotation

Codecov / codecov/patch

virtual_machine.go#L500-L501

Added lines #L500 - L501 were not covered by tests
return
}

Expand Down

0 comments on commit f3f470a

Please sign in to comment.