I would like to use Ruby to open a mysql prompt for the user. The
password is read from a file, and should be passed to mysel. However, I
don’t want to have the password appear in the list of processes (don’t
use the mysql -p option)
A comment at the end of
shows how to accomplish that within bash scripts, which is quite nice.
It works like the string in this code:
‘db-dev’ ‘localhost’ ‘/var/run/mysqld/mysqld.sock’ ‘db-user’ ‘db-passwd’
3<&0 <&4 4<&- /usr/local/mysql/bin/mysql --defaults-file=/dev/fd/3
As you can see some clever use of file-descriptors. The exec-call works
in Ruby, and the mysql prompt is opened, but running “ps” will reveal
the password (not that surprising).
Is there a way to do this in Ruby?