# Is there something built-in for this?

**URL:** <https://www.ruby-forum.com/t/is-there-something-built-in-for-this/159537>\
**Category:** Ruby\
**Created:** [February 5, 2009, 2:55pm UTC](https://www.ruby-forum.com/t/is-there-something-built-in-for-this/159537 "2009-02-05T14:55:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [February 5, 2009, 2:55pm UTC](https://www.ruby-forum.com/t/is-there-something-built-in-for-this/159537/1 "2009-02-05T14:55:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [February 8, 2009, 10:10am UTC](https://www.ruby-forum.com/t/is-there-something-built-in-for-this/159537/2 "2009-02-08T10:10:54Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![thbar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/eb8c5e/32.png) [@thbar](https://www.ruby-forum.com/u/thbar)\
**Post date:** [February 8, 2009, 1:14pm UTC](https://www.ruby-forum.com/t/is-there-something-built-in-for-this/159537/3 "2009-02-08T13:14:59Z")

</div>

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
