db:dump returns exit code 0 on fail
wb-lime opened this issue · 5 comments
wb-lime commented
n98 version: version 1.102.0
db:dump returns exit code 0 if a dump fails.
In this case the flat tables where being indexed.
To reproduce run the db:dump command while the flat tables are being indexed.
Cli prints the message from mysqldump but n98 does not throw an error.
mysqldump version: mysqldump Ver 10.13 Distrib 5.7.25, for Linux
mysqldump: Error 1412: Table definition has changed, please retry transaction when dumping table `catalog_product_flat_13` at row: 0
Direct mysqldump returns exit code 3
mysqldump -u root -p --single-transaction magento_db > dump-test-direct.sql; echo $?
expected result:
error is thrown, non zero exit code
actual result:
now error is thrown, exit code is 0, command reports as 'finished'
cmuench commented
I found the problem. If a command is called in a pipe the return code of the last command is used. The option set -o pipefail
will fix the problem.
We will create a patch for that.
cmuench commented
Sadly this works only in a bash/zsh. :-(