From fdae2635164403f67b8d61ea33e6bc1d4f90d6fd Mon Sep 17 00:00:00 2001 From: rlakey Date: Thu, 10 Feb 2022 12:29:31 -0700 Subject: [PATCH] Fix for Windows w/pwsh installed for vmware train Signed-off-by: rlakey --- lib/train/transports/vmware.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/train/transports/vmware.rb b/lib/train/transports/vmware.rb index d079442a..8b3e1bb3 100644 --- a/lib/train/transports/vmware.rb +++ b/lib/train/transports/vmware.rb @@ -98,10 +98,11 @@ def uri private def detect_powershell_binary - if find_executable0("pwsh") - :pwsh - elsif find_executable0("powershell") + # Detect Powershell first in case of Windows with Powershell 6/7/Core installed as flush_stdout/stderr doesn't work for pwsh on Windows. + if find_executable0("powershell") :powershell + elsif find_executable0("pwsh") + :pwsh else raise "Cannot find PowerShell binary, is `pwsh` installed?" end