lib/bluepill/system.rb in dylanvaughn-bluepill-0.0.39 vs lib/bluepill/system.rb in dylanvaughn-bluepill-0.0.40

- old
+ new

@@ -31,11 +31,11 @@ def memory_usage(pid) ps_axu[pid] && ps_axu[pid][IDX_MAP[:rss]].to_f end def get_children(parent_pid) - returning(Array.new) do |child_pids| + Array.new.tap do |child_pids| ps_axu.each_pair do |pid, chunks| child_pids << chunks[IDX_MAP[:pid]].to_i if chunks[IDX_MAP[:ppid]].to_i == parent_pid.to_i end end end @@ -66,11 +66,11 @@ exit unless can_write_pid_file(options[:pid_file], options[:logger]) to_daemonize = lambda do # Setting end PWD env emulates bash behavior when dealing with symlinks Dir.chdir(ENV["PWD"] = options[:working_dir]) if options[:working_dir] - options[:environment].each { |key, value| ENV[key] = value } + options[:environment].each { |key, value| ENV[key] = value } if options[:environment] redirect_io(*options.values_at(:stdin, :stdout, :stderr)) ::Kernel.exec(cmd) exit @@ -113,10 +113,10 @@ pid = fork { # grandchild drop_privileges(options[:uid], options[:gid]) Dir.chdir(ENV["PWD"] = options[:working_dir]) if options[:working_dir] - options[:environment].each { |key, value| ENV[key] = value } + options[:environment].each { |key, value| ENV[key] = value } if options[:environment] # close unused fds so ancestors wont hang. This line is the only reason we are not # using something like popen3. If this fd is not closed, the .read call on the parent # will never return because "wr" would still be open in the "exec"-ed cmd wr.close