From 36a3b13bf49b35372fd26fe2d6c62d2af33258bb Mon Sep 17 00:00:00 2001 From: Jeremy Daer Date: Thu, 4 May 2023 08:58:18 -0700 Subject: [PATCH] Fix SSHKit #command override args mangling --- lib/mrsk/sshkit_with_ext.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/mrsk/sshkit_with_ext.rb b/lib/mrsk/sshkit_with_ext.rb index bc8de309..cbd5dc23 100644 --- a/lib/mrsk/sshkit_with_ext.rb +++ b/lib/mrsk/sshkit_with_ext.rb @@ -22,9 +22,11 @@ class SSHKit::Backend::Abstract # Override to merge options returned by commands in the args list with # options passed by the CLI and pass them along as kwargs. - def command(*args_and_options) - options, args = args_and_options.partition { |a| a.is_a? Hash } - build_command(*args, **options.reduce(:deep_merge)) + def command(args, options) + more_options, args = args.partition { |a| a.is_a? Hash } + more_options << options + + build_command(args, **more_options.reduce(:deep_merge)) end # Destructure options to pluck out env for merge