Is there something built-in for this?


#1

Hi,

very often I use this method:

def launch(cmd)
raise “Error launching #{cmd}” unless system(cmd)
end

Is there a built-in equivalent ?

cheers,

– Thibaut


#2

begin
system(cmd)
rescue NameError => e
puts e
end

… Does that help you ?

hum – not sure actually. Is system() supposed to raise a NameError ?
I didn’t see this mentioned in the docs.

I searched further yet could not find anything like launch() so far.

– Thibaut


#3

Thibaut Barrère wrote:

begin
� system(cmd)
rescue NameError => e
� puts e
end

… Does that help you ?

hum – not sure actually. Is system() supposed to raise a NameError ?
I didn’t see this mentioned in the docs.

Easy enough to test:

begin
result = system(“made up command”)
puts result
rescue NameError => e
puts e
end

–output:–
false