mirror of
https://git.baguette.netlib.re/Baguette/networkctl
synced 2024-12-18 13:03:30 +00:00
23 lines
490 B
Crystal
23 lines
490 B
Crystal
|
|
||
|
class Do < Process
|
||
|
class_property simulation = false
|
||
|
|
||
|
def self.run(cmd : String, params : Array(String) = nil)
|
||
|
if @@simulation
|
||
|
puts "simulation, do: #{cmd} #{params.join(" ")}"
|
||
|
Process::Status.new 0
|
||
|
else
|
||
|
Process.run cmd, params
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def self.run(cmd : String, params : Array(String) = nil, &block : Process -> _)
|
||
|
if @@simulation
|
||
|
puts "simulation, do: #{cmd} #{params.join(" ")}"
|
||
|
Process::Status.new 0
|
||
|
else
|
||
|
Process.run cmd, params, &block
|
||
|
end
|
||
|
end
|
||
|
end
|