views:

52

answers:

2

I am catching emails to "script@localhost" with /etc/aliases:

script:   root,"|/path-to-my-script"

this gets an email on STDIN and I am parsing and passing it to other scripts.

#!/usr/bin/ruby
email = ARGF.read
...parse...parse-some-more...
system("/my-other-script.sh #{email.todo}")

the question is - what would be a best way to capture the STDOUT of my-other-script.sh for troubleshooting?

A: 

Did you take a look at IO.popen yet?

I'm not an expert, but it might be worth taking a look there.

Beanish
A: 

I am going with :

out = `/my-other-script.sh #{email.todo} 2>&1`
log.debug $?.exitstatus
log.debug out

seems to work

webwesen