Skip to content

Commit

Permalink
Merge pull request #29 from upfrontIO/fix-multiline-command
Browse files Browse the repository at this point in the history
Fix execution of template string with shell.exec
  • Loading branch information
DaRaFF authored May 30, 2018
2 parents 43a7735 + f9effe1 commit 9a4dd02
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/modules/exec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = function (dep) {
const { shell, console, colors } = dep
return function (command, dryRun = false) {
console.log(colors.yellow(` ${command}`))
const cmd = command.replace(/(?:\\[rn]|[\r\n]+)+/g, '')
console.log(colors.yellow(` ${cmd}`))
if (!dryRun) {
const result = shell.exec(command)
result.stdout = result.stdout.replace(/\n$/, '')
result.stdout = result.stdout.replace(/\n$/, '')
const result = shell.exec(cmd)
result.stdout = result.stdout.replace(/(?:\\[rn]|[\r\n]+)+/g, '')
return result
}
}
Expand Down

0 comments on commit 9a4dd02

Please sign in to comment.