al-quran.reflectslight.io/lib/rake/cmd.rb

20 lines
456 B
Ruby
Raw Normal View History

2022-11-02 04:49:43 +01:00
# frozen_string_literal: true
2022-10-31 19:34:23 +01:00
module Cmd
def cmd(cmd, *args, silent: false)
print " -> #{cmd}: " unless silent
_, result = Process.wait2 Process.spawn(
[cmd, cmd],
*args,
2022-11-02 04:49:43 +01:00
$stderr => File::NULL,
$stdout => File::NULL
2022-10-31 19:34:23 +01:00
)
2022-11-02 04:49:43 +01:00
if result.success?
2022-10-31 19:34:23 +01:00
print Paint["OK", :green, :bold], "\n" unless silent
else
print Paint["ERROR", :red, :bold], "\n" unless silent
exit result.exitstatus
end
end
end