Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a command line program that is expecting to be passed a configuration file e.g.

sphinx --config /some/config_file

I'm calling this command from inside a Ruby program where I'm currently dynamically generating the config file before writing it to disk. This seems like a waste as the file is only used once and deleted right after.

Is there a way to avoid writing the file to disk by just passing in something that the program will think is a file but really hasn't been written to disk?

share|improve this question
1  
Look at /dev/stdout and /dev/stdin there may be a way to redirect output to stdout and read it inside ruby. Just an idea. –  Christopher Wilson May 2 '12 at 3:03

1 Answer 1

up vote 4 down vote accepted

You can pass a FD node and then have Ruby communicate using that FD on the process.

sphinx --config /dev/fd/10
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.