build_ssh_cmd

in lib/taste_tester/ssh_util.rb [99:195]


      def build_ssh_cmd(ssh, command_list)
        if TasteTester::Config.windows_target
          # Powershell has no `&&`. So originally we looked into joining the
          # various commands with `; if ($LASTEXITCODE -ne 0) { exit 42 }; `
          # except that it turns out lots of Powershell commands don't set
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          

          cmds = command_list.join(' ; ')
        else
          cmds = command_list.join(' && ')
        end
        cmd = "#{ssh} "
        cc = Base64.encode64(cmds).delete("\n")
        if TasteTester::Config.windows_target

          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          
          

          
          
          fun1 = '[Text.Encoding]::Utf8.GetString'
          fun2 = '[Convert]::FromBase64String'
          cmd += "'#{fun1}(#{fun2}('\"'#{cc}'))\"' | "
          
          
          
          cmd += 'powershell.exe -c -; exit $LASTEXITCODE\''
          
          
        else
          cmd += "\"echo '#{cc}' | base64 --decode"
          if TasteTester::Config.user != 'root'
            cmd += ' | sudo bash -x"'
          else
            cmd += ' | bash -x"'
          end
        end
        cmd
      end