danielinsley.com
Ruby standard out piping problems on Ubuntu
I've been having problems where the output of binaries was not being redirected properly from within Ruby when invoked as followed:
>> `ls -l &> /dev/null` => "total 4 drwxr-xr-x 2 dinsley dinsley 4096 2007-05-08 20:00 Peepcode - Rest"
If the shell supports this piping convention, it should return the following:
>> `ls -l &> /dev/null` => ""
Ubuntu currently ships with the '/bin/sh' symbolic link pointing to '/bin/dash' with the reasoning that it executes scripts somewhat faster than bash. There are some drawbacks to this. One of these is that stdout redirection of output from the binary will not be redirected to /dev/null if redirecting it via &>, as it isn't supported in dash.
To fix this, all you need to do is remove the existing symbolic link to dash and replace it with a link to bash instead:
$ sudo rm /bin/sh $ sudo ln -s /bin/bash /bin/sh
Comments
There are no comments for this post.
Add comment
About me
I'm a 23 year old Software Developer from British Columbia, Canada. I currently have the privilege of writing Ruby full time at viviti.com. I enjoy spending my time with my family, programming, watching hockey, and listening to all kinds of music!
Archive
- October 2008 (1)
- September 2008 (1)
- May 2008 (2)
- April 2008 (2)
- March 2008 (3)
