Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set return code for SetModeCommand #4845

Merged
merged 1 commit into from
Sep 22, 2016
Merged

Set return code for SetModeCommand #4845

merged 1 commit into from
Sep 22, 2016

Conversation

marvincaspar
Copy link

In case of running the bin/magento deploy:mode:set production command
in a shell script this will return an error code 129 and all other
commands after this will not be executed.

In case of running the `bin/magento deploy:mode:set production` command
in a shell script this will return an error code 129 and all other
commands after this will not be executed.
@vkublytskyi vkublytskyi added the PS label Jun 3, 2016
@vkorotun vkorotun removed the PS label Aug 3, 2016
@vkorotun vkorotun added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report bugfix and removed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report labels Aug 4, 2016
@vkorotun vkorotun added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: accept labels Sep 14, 2016
@vkorotun
Copy link
Contributor

Internal ticket: MAGETWO-58373

@vkorotun vkorotun removed Progress: accept Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Sep 16, 2016
@vkorotun vkorotun self-assigned this Sep 16, 2016
@vkorotun vkorotun added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: accept labels Sep 16, 2016
@guz-anton
Copy link
Contributor

guz-anton commented Sep 19, 2016

Hi Marvin,
Could you provide an example (or describe an environment) when command deploy:mode:set fails?
It is interesting how you caught a situation with "other commands after this will not be executed".

-- Anton Guz

@marvincaspar
Copy link
Author

Hi @guz-anton,
this happens if you want to setup magento on different environments with a shell script.

The script includes different steps:

  • clone the repository
  • import a backup
  • set deployment mode
  • clear cache
  • run indexer
  • do some other stuff

And if the command returns the wrong status code the script stops and the appended task will not execute.

@guz-anton
Copy link
Contributor

Hmm.. I understand what is a shell script (or no?). For example:

#!/bin/bash

sudo -H -u www-data php bin/magento deploy:mode:set production
sudo -H -u www-data php bin/magento deploy:mode:set developer
sudo -H -u www-data php bin/magento deploy:mode:set default

touch sample.test.file
pwd
pwd
ls -la

I have successful directory listing in both cases: with your changes and without. So I want to understand when exactly you faced with issue. Could you list your .sh example?

@marvincaspar
Copy link
Author

you have to use set -e to exit on the first error, for example:

#!/bin/bash

set -e

php bin/magento deploy:mode:set production

@mmansoor-magento mmansoor-magento merged commit c60a251 into magento:develop Sep 22, 2016
@guz-anton
Copy link
Contributor

@mc388 great thanks for contribution!

@Ctucker9233
Copy link

@mmansoorebay @guz-anton is this PR going to be included in 2.1.3?

magento-engcom-team pushed a commit that referenced this pull request Oct 2, 2019
[TSG] Fixes for 2.3 (pr76) (2.3-develop)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Frontend bugfix Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: accept
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants