lib/rbbt/util/cmd.rb in rbbt-util-5.26.67 vs lib/rbbt/util/cmd.rb in rbbt-util-5.26.68

- old
+ new

@@ -142,22 +142,26 @@ def self.cmd_log(*args) all_args = *args all_args << {} unless Hash === all_args.last + + level = all_args.last[:log] || 0 + level = level.to_i + all_args.last[:log] = true all_args.last[:pipe] = true io = cmd(*all_args) pid = io.pids.first while c = io.getc - STDERR << c if Log.severity == 0 + STDERR << c if Log.severity <= level if c == "\n" if pid - Log.logn "STDOUT [#{pid}]: ", 0 + Log.logn "STDOUT [#{pid}]: ", level else - Log.logn "STDOUT: ", 0 + Log.logn "STDOUT: ", level end end end io.join