diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index 48fed2b..b1cf4de 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -509,8 +509,11 @@ def cmd(string)
IO.popen("#{string} 2>&1", "r") do |pipe|
while line = pipe.gets()
$log.puts line
- puts line if Rbpkg.verbose_level > 1
- $stdout.flush
+ $log.flush
+ if Rbpkg.verbose_level > 1
+ puts line
+ $stdout.flush
+ end
end
pipe.close
$?.success?