al-quran.reflectslight.io/lib/rake/cmd.rb
2022-10-31 15:36:25 -03:00

18 lines
430 B
Ruby

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
)
case
when 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