aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Moritz2017-06-26 21:33:12 +0200
committerChristian Moritz2017-06-29 20:29:25 +0200
commit495520a1f9d55712a6a0d3eae6123fda60dbaeae (patch)
tree8e4749789b71d63d0965227ce6559aeb7d66b847
parent02113e2714aae818ee2c43e203137b3cd0b61ced (diff)
downloadbrew-495520a1f9d55712a6a0d3eae6123fda60dbaeae.tar.bz2
language/node: make packname detection more robust
This fixes some edge cases where verbose output from a prepublish script could break our npm pack package name detection code by only using the last line of the output printed by npm itself containing the desired package name.
-rw-r--r--Library/Homebrew/language/node.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/Library/Homebrew/language/node.rb b/Library/Homebrew/language/node.rb
index 98d376766..86874e385 100644
--- a/Library/Homebrew/language/node.rb
+++ b/Library/Homebrew/language/node.rb
@@ -11,8 +11,10 @@ module Language
# directory, consequently breaking that assumption. We require a tarball
# because npm install creates a "real" installation when fed a tarball.
output = Utils.popen_read("npm pack").chomp
- raise "npm failed to pack #{Dir.pwd}" unless $CHILD_STATUS.exitstatus.zero?
- output
+ if !$CHILD_STATUS.exitstatus.zero? || output.lines.empty?
+ raise "npm failed to pack #{Dir.pwd}"
+ end
+ output.lines.last.chomp
end
def self.setup_npm_environment