From b061644b190c7e16a6e1fc722dabb2fc4a6289af Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Fri, 6 May 2016 13:11:57 -0400 Subject: [PATCH] Make resin ssh work in Windows cmd.exe Signed-off-by: Juan Cruz Viotti --- build/actions/ssh.js | 4 ++-- lib/actions/ssh.coffee | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/build/actions/ssh.js b/build/actions/ssh.js index 506c8dbc..569e98db 100644 --- a/build/actions/ssh.js +++ b/build/actions/ssh.js @@ -23,8 +23,8 @@ limitations under the License. os = require('os'); if (os.platform() === 'win32') { return { - program: 'sh', - args: ['-c', command] + program: 'cmd.exe', + args: ['/s', '/c', command] }; } else { return { diff --git a/lib/actions/ssh.coffee b/lib/actions/ssh.coffee index a18d34d7..c04b7aa0 100644 --- a/lib/actions/ssh.coffee +++ b/lib/actions/ssh.coffee @@ -14,14 +14,20 @@ See the License for the specific language governing permissions and limitations under the License. ### +# TODO: A function to reliably execute a command +# in all supported operating systems, including +# different Windows environments like `cmd.exe` +# and `Cygwin` should be encapsulated in a +# re-usable package. +# This is literally copy-pasted from the `resin-sync` +# module. getSubShellCommand = (command) -> os = require('os') - # Assume Cygwin if os.platform() is 'win32' return { - program: 'sh' - args: [ '-c', command ] + program: 'cmd.exe' + args: [ '/s', '/c', command ] } else return {