@@ -10,7 +10,7 @@ import (
1010
1111 "github.com/hashicorp/packer-plugin-sdk/multistep"
1212 packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
13- "github.com/mitchellh /go-vnc"
13+ "github.com/tenthirtyam /go-vnc"
1414)
1515
1616// StepVNCConnect represents a step for establishing VNC connection to the virtual machine.
@@ -27,7 +27,7 @@ func (s *StepVNCConnect) Run(ctx context.Context, state multistep.StateBag) mult
2727 ui := state .Get ("ui" ).(packersdk.Ui )
2828
2929 ui .Say ("Connecting to VNC..." )
30- c , err := s .ConnectVNC (state )
30+ c , err := s .ConnectVNC (ctx , state )
3131 if err != nil {
3232 err = fmt .Errorf ("error connecting to VNC: %s" , err )
3333 state .Put ("error" , err )
@@ -40,7 +40,7 @@ func (s *StepVNCConnect) Run(ctx context.Context, state multistep.StateBag) mult
4040}
4141
4242// ConnectVNC establishes a direct VNC connection to the virtual machine.
43- func (s * StepVNCConnect ) ConnectVNC (state multistep.StateBag ) (* vnc.ClientConn , error ) {
43+ func (s * StepVNCConnect ) ConnectVNC (ctx context. Context , state multistep.StateBag ) (* vnc.ClientConn , error ) {
4444 vncIp := state .Get ("vnc_ip" ).(string )
4545 vncPort := state .Get ("vnc_port" ).(int )
4646 vncPassword := state .Get ("vnc_password" )
@@ -57,7 +57,7 @@ func (s *StepVNCConnect) ConnectVNC(state multistep.StateBag) (*vnc.ClientConn,
5757 auth = []vnc.ClientAuth {& vnc.PasswordAuth {Password : vncPassword .(string )}}
5858 }
5959
60- c , err := vnc .Client ( nc , & vnc.ClientConfig {Auth : auth , Exclusive : true })
60+ c , err := vnc .ClientWithContext ( ctx , nc , & vnc.ClientConfig {Auth : auth , Exclusive : true })
6161 if err != nil {
6262 err := fmt .Errorf ("error handshaking with VNC: %s" , err )
6363 state .Put ("error" , err )
0 commit comments