Permalink
Browse files

Use /bin/sh as the default if $SHELL isn't set in the environment.

Fixes #607
  • Loading branch information...
1 parent 21fca92 commit 2ea05179676d97f4dbb80a00cef5cafb3f09e2e1 @jordansissel committed Feb 5, 2014
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/fpm/util.rb
View
8 lib/fpm/util.rb
@@ -30,12 +30,18 @@ def program_in_path?(program)
return envpath.select { |p| File.executable?(File.join(p, program)) }.any?
end # def program_in_path
+ def default_shell
+ shell = ENV["SHELL"]
+ return "/bin/sh" if shell.nil? || shell.empty?
+ return shell
+ end
+
# Run a command safely in a way that gets reports useful errors.
def safesystem(*args)
# ChildProcess isn't smart enough to run a $SHELL if there's
# spaces in the first arg and there's only 1 arg.
if args.size == 1
- args = [ ENV["SHELL"], "-c", args[0] ]
+ args = [ default_shell, "-c", args[0] ]
end
program = args[0]

0 comments on commit 2ea0517

Please sign in to comment.