Project

General

Profile

Actions

Bug #21089

closed

Prompt for keyboard input does not get displayed in CLI scripts

Added by Francois Suter about 15 years ago. Updated over 14 years ago.

Status:
Closed
Priority:
Must have
Category:
-
Target version:
-
Start date:
2009-09-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.3
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When running the lowlevel_cleaner script with --AUTOFIX or -i options, validation is requested from the user. In my setup the prompt does not get displayed.

Simply adding:

ob_flush();

after:

echo $msg.' (Yes/No + return): ';

in class.t3lib_cli.php (around line 225) solves the issue.

This is an example command that I tried to run:

/path/to/php /path/to/website/typo3/cli_dispatch.phpsh lowlevel_cleaner orphan_records -r --refindex update --AUTOFIX

Running this command, you should be prompted with the following question:

NOW Running --AUTOFIX on result. OK? (Yes/No + return):

I don't get anything. I tried with TYPO3 4.1 running PHP 4.4.8 and TYPO3 4.2 and Trunk running PHP 5.2.6. The problem is the same no matter the configuration.
(issue imported from #M11995)


Files

rfc11995.diff (481 Bytes) rfc11995.diff Administrator Admin, 2009-09-19 12:25

Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #21236: Add API functions for cleaning and flushing output buffersClosedRupert Germann2009-10-11

Actions
Related to TYPO3 Core - Bug #21325: Output compression breaks prompt for keyboard input in CLI scriptsClosedRupert Germann2009-10-21

Actions
Actions #1

Updated by Andreas Wolf about 15 years ago

I think we would need a more general approach here. There are some extensions which start output caching with ob_start(), which usually leads to confusion when running CLI scripts. This is not only a source of errors like these, but also leads to confusion when scripts do not output anything while running.

Perhaps we can run ob_end_flush() before running the extension CLI script?

Actions #2

Updated by Francois Suter about 15 years ago

Thanks for the pointer Andreas. I searched for ob_start() through the whole source code and found an ob_start() call right near the beginning of typo3/init.php. That must be the one blocking everything. It was added in revision 4564 to solve problem during gzip-compressed output.

So your solution seems to be the right one: call ob_end_flush() in cli_dispatch.php after the inclusion of init.php.

It also explains why I remembered having been able to run CLI scripts in the past. On older TYPO3 installs it would work, before revision 4564.

Thanks for solving the mystery. I'll submit the patch now.

Actions #3

Updated by Francois Suter about 15 years ago

Changing the title to reflect the true nature of the issue.

Actions #4

Updated by Francois Suter about 15 years ago

Raising priority as this block all CLI output

Actions #5

Updated by Francois Suter about 15 years ago

Committed to trunk in revision 6013.
Committed to 4.2 in revision 6014.
Committed to 4.1 in revision 6015.

Actions

Also available in: Atom PDF