I'm using a MySQL client connection to issue FLUSH TABLES WITH READ LOCK
and then create an LVM snapshot. I'd like the higher-level script (Ruby) to capture the return code of the snapshot creation, but cannot determine how to capture that within the MySQL client. To simplify:
mysql> system pwd
/root
I would expect that system
to return 0.
mysql> system foo
sh: 1: foo: not found
I would expect that system
to return 127 in bash, etc.
Is there some way to retrieve that error code within the MySQL client and return it when the MySQL client exits, write it to a file to read by the controlling script, etc.