Make resin ssh work in Windows cmd.exe

Signed-off-by: Juan Cruz Viotti <jviottidc@gmail.com>
This commit is contained in:
Juan Cruz Viotti 2016-05-06 13:11:57 -04:00
parent 38b97baf02
commit b061644b19
2 changed files with 11 additions and 5 deletions

View File

@ -23,8 +23,8 @@ limitations under the License.
os = require('os'); os = require('os');
if (os.platform() === 'win32') { if (os.platform() === 'win32') {
return { return {
program: 'sh', program: 'cmd.exe',
args: ['-c', command] args: ['/s', '/c', command]
}; };
} else { } else {
return { return {

View File

@ -14,14 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License. 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) -> getSubShellCommand = (command) ->
os = require('os') os = require('os')
# Assume Cygwin
if os.platform() is 'win32' if os.platform() is 'win32'
return { return {
program: 'sh' program: 'cmd.exe'
args: [ '-c', command ] args: [ '/s', '/c', command ]
} }
else else
return { return {