al-quran.reflectslight.io/lib/rake/cmd.rb
2022-11-02 00:53:00 -03:00

19 lines
456 B
Ruby

# frozen_string_literal: true
module Cmd
def cmd(cmd, *args, silent: false)
print " -> #{cmd}: " unless silent
_, result = Process.wait2 Process.spawn(
[cmd, cmd],
*args,
$stderr => File::NULL,
$stdout => File::NULL
)
if result.success?
print Paint["OK", :green, :bold], "\n" unless silent
else
print Paint["ERROR", :red, :bold], "\n" unless silent
exit result.exitstatus
end
end
end