-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add additional ssh options #24
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,15 @@ var exec = require('child_process').exec; | |
|
||
var scp = module.exports = {}; | ||
|
||
function buildSshOptions(options) { | ||
result = ''; | ||
var ssh_options = options.ssh_options || {} | ||
ssh_options['ControlMaster'] = 'no' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should be a default but overridable |
||
Object.keys(ssh_options).map(function (key) { | ||
result += "-o " + key + '=' + ssh_options[key] + ' ' | ||
}) | ||
return result.trim(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please match the indentation to the rest of the file There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there is inconsistent use of semicolons here, please use them everywhere |
||
/* | ||
* Transfer a file to a remote host | ||
*/ | ||
|
@@ -15,7 +24,7 @@ scp.send = function (options, cb) { | |
'-r', | ||
'-P', | ||
(options.port == undefined ? '22' : options.port), | ||
'-o "ControlMaster no"', //callback is not fired if ssh sessions are shared | ||
buildSshOptions(options), | ||
options.file, | ||
(options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.path, | ||
]; | ||
|
@@ -32,12 +41,14 @@ scp.send = function (options, cb) { | |
* Grab a file from a remote host | ||
*/ | ||
scp.get = function (options, cb) { | ||
var ssh_options = ["ControlMaster=no"]; //callback is not fired if ssh sessions are shared | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is redundant given similar code in |
||
ssh_options = options.ssh ? ssh_options.concat(options.ssh) : ssh_options; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you make |
||
var command = [ | ||
'scp', | ||
'-r', | ||
'-P', | ||
(options.port == undefined ? '22' : options.port), | ||
'-o "ControlMaster no"', //callback is not fired if ssh sessions are shared | ||
buildSshOptions(options), | ||
(options.user == undefined ? '' : options.user+'@') + options.host + ':' + options.file, | ||
options.path | ||
]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these examples use a different indentation from the rest of the file