Fix osmosis argument generation

Also fix return code handling & handle the possibility of an exception being raised when running osmosis.