Error handling with command calls

S

Stefan Schmidt

Hello,

I'm trying to rewrite a Bash shell script with Ruby.

`do_something`
if $?.exitstatus != 0
handle_error
end

`do_some_other_thing`
if $?.exitstatus != 0
handle_error
end

How can I avoid having to poll exitstatus after every command call? I'm looking for something to replace bash's trap.

Stefan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,663
Latest member
josh5959

Latest Threads

Top