diff --git a/lib/main.js b/lib/main.js index 872ce9f1..f95f36a1 100644 --- a/lib/main.js +++ b/lib/main.js @@ -154,7 +154,7 @@ Lambda.prototype._rsync = function (program, src, dest, callback) { // we need the extra / after src to make sure we are copying the content // of the directory, not the directory itself. - exec('rsync -r ' + excludeArgs + ' ' + src.trim() + '/ ' + dest, function (err) { + exec('rsync -rL ' + excludeArgs + ' ' + src.trim() + '/ ' + dest, function (err) { if (err) { return callback(err); } @@ -287,8 +287,11 @@ Lambda.prototype._setEnvironmentVars = function (program, codeDirectory) { } prefix += '////////////////////////////////////\n\n'; + if (contentStr.trim().indexOf('/// node-lambda: env') !== -1) { + contentStr = contentStr.replace(/(\/\/\/\s?node-lambda: env\s*?\n)/, prefix); + } // If the first line of the file is 'use strict', append after - if (contentStr.trim().indexOf('use strict') === 1) { + else if (contentStr.trim().indexOf('use strict') === 1) { contentStr = contentStr.replace(/([`'"]use strict[`'"][;]?)/, '$1\n' + prefix); } else { contentStr = prefix + contentStr;