Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .