From 161b08bc4d63823138ff35ebedcb842daa7c7d37 Mon Sep 17 00:00:00 2001 From: Celian Raimbault Date: Wed, 11 Dec 2024 15:34:51 +0100 Subject: [PATCH] [refactor-runner-adxt-783] runner: Fixed lock warning --- components/command/runner.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/components/command/runner.go b/components/command/runner.go index d970dfe13..1f5d48d8e 100644 --- a/components/command/runner.go +++ b/components/command/runner.go @@ -61,11 +61,11 @@ type Command interface { } type LocalCommand struct { - local.Command + *local.Command } type RemoteCommand struct { - remote.Command + *remote.Command } var _ Command = &RemoteCommand{} @@ -172,7 +172,11 @@ func (r *RemoteRunner) Command(name string, args *Args, opts ...pulumi.ResourceO cmd, err := remote.NewCommand(r.e.Ctx(), r.namer.ResourceName("cmd", name), args.toRemoteCommandArgs(r.config, r.osCommand), utils.MergeOptions(r.options, opts...)...) - return &RemoteCommand{*cmd}, err + if err != nil { + return &RemoteCommand{cmd}, nil + } + + return nil, err } func (r *RemoteRunner) NewCopyFile(name string, localPath, remotePath pulumi.StringInput, opts ...pulumi.ResourceOption) (pulumi.Resource, error) { @@ -228,7 +232,11 @@ func (r *LocalRunner) Command(name string, args *Args, opts ...pulumi.ResourceOp opts = utils.MergeOptions[pulumi.ResourceOption](opts, r.e.WithProviders(config.ProviderCommand)) cmd, err := local.NewCommand(r.e.Ctx(), r.namer.ResourceName("cmd", name), args.toLocalCommandArgs(r.config, r.osCommand), opts...) - return &LocalCommand{*cmd}, err + if err != nil { + return &LocalCommand{cmd}, nil + } + + return nil, err } func (r *LocalRunner) NewCopyFile(name string, localPath, remotePath pulumi.StringInput, opts ...pulumi.ResourceOption) (pulumi.Resource, error) {