netz98/n98-magerun2

Commands passed via script do not run with --no-interaction

benjamenjohnsondev opened this issue · 0 comments

Describe the bug

When running for example: /usr/local/bin/n98-magerun.phar -n --root-dir=/var/www/qa/site script /var/www/site/app/etc/local.magerun.conf the commands are run with interaction - the --no-interaction is not inherited

This affects commands like indexer:reindex and indexer:set-mode

This results in the following error:

In Process.php line 1063:
TTY mode requires /dev/tty to be read/writable

Expected behaviour

If set on the parent Magerun command, Magento commands in script files are run with --no-interaction

Steps to reproduce the issue

Create file: magerun.conf:

! bin/magento indexer:set-mode schedule
! bin/magento indexer:reindex
indexer:set-mode schedule
indexer:reindex

n98-magerun2 -n --root-dir=/var/www/site script magerun.conf

Observe that the first two commands run as expected

The final 2 commands throw the error:

In Process.php line 1063:
TTY mode requires /dev/tty to be read/writable

Technical details

Linux non-interactive shell

Possible Fix

Pass no-interaction to child commands if set

Additional context