8000 [bug]: no progress helper output on windows · Issue #10011 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[bug]: no progress helper output on windows #10011

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

Closed
bazo opened this issue Jan 13, 2014 · 16 comments
Closed

[bug]: no progress helper output on windows #10011

bazo opened this issue Jan 13, 2014 · 16 comments
Labels

Comments

@bazo
Copy link
bazo commented Jan 13, 2014

on windows, git bash shell

progress helper has no output

the reason is on this line https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Helper/ProgressHelper.php#L191

ConsoleOutput says it's not decorated, so the output gets set to NullOutput

in 2.3 i get output, it's all white but it's there.

could the white output be returned to windows instead of none?
thanks

and git bash clearly supports colors as the username is green and folder is yellow. also node.js produces colored output.

@sstok
Copy link
Contributor
sstok commented Jan 13, 2014

Windows CAN support colors using ANSICON but you need to install and configure this manually, Git shell uses sh.exe wrapped with cmd.exe and so does node.js (somehow) but PHP uses CMD which does not support ANSI colors.

Its also possible to use a better shell for Windows, but I have been unable to get that working.

@bazo
Copy link
Author
bazo commented Jan 13, 2014

ok, but that doesn't change the fact that there's is no output from progress helper by default on current version.
and that it worked before. i don't care about the colors i want to see the progress :)

@stof
Copy link
Member
stof commented Jan 13, 2014

This is expected. If the output is not decorated, the display of the progress bar would be totally messed up, as it uses some ANSI control sequences to handle the overwriting.

gitBash emulates colors only for git, by using a special build of Git. They don't apply their emulation for other processes running in the shell. Using the native APIs to set the console color cannot be done from PHP, as it is not controlled by the text stream itself but by some C API.

Symfony uses the ANSI control sequences to display colors in the console output. If you want colors in your Windows console, I suggest you to use conEmu, which supports ANSI colors and is detected by Symfony to mark the output as decorated (or ANSICON as suggested by @sstok). My current setup is to run gitbash (because I prefer bash over the cmd for command line) inside conEmu (to support colors and other cool features of ConEmu)

@bazo
Copy link
Author
bazo commented Jan 13, 2014

i think you totally miss the point. on 2.3 version i have output. on 2.4 i see nothing. this is clearly a regression.
and as i said i don't need the colors.

so i'm sticking to 2.3 for now

@stof
Copy link
Member
stof commented Jan 13, 2014

hmm, it is true that Windows properly handle the overwriting sequence chars even without supporting the ANSI colors.

@wouterj
Copy link
Member
wouterj commented Jan 13, 2014

The problem is the line that you pointed out.

As far as I can read in #9511 checking if it was decorated was just a trick to not get problems when using a CI. But the problem is that it also breaks Windows.

There should be another better way to check if the console is run in a CI or not. Already suggested were --no-interaction and --no-ansi (which was now used, resulting in this bug)

@stof
Copy link
Member
stof commented Jan 13, 2014

no-interaction was rejected because it is totally unrelated (it is a flag for the input, while we are interested in the output).
--no-ansi was used to decide whether the output can support controls chars based on its support of ANSI colors. But it is true that it could support one without the other (i.e. Windows). The issue about the overwriting controls chars is that its support may depend of who gets the output of the process.

@wouterj
Copy link
Member
wouterj commented Jun 8, 2014

Ping, can someone come up with a solution for this?

I also think that simply ignoring the complete output of the progress bar is not the best way of doing things. We can only just show something at the start and end of a progress. That way, we don't need to override characters. The current way (hiding it completely) made me bussy for 1 hour debugging why the bar wasn't shown.

@dedalozzo
Copy link

I have to say that the progress doesn't work in Mac OS X since 2.5. I had to revert to 2.4.*@dev.

@sstok
Copy link
Contributor
sstok commented Jun 9, 2014

@wouterj I'm currently using EmuCon (http://code.google.com/p/conemu-maximus5/wiki/ConEmu) which was recommended by stof, and works perfect!

@kbond
Copy link
Member
kbond commented Sep 5, 2014

Can you guys weigh in on #11852?

fabpot added a commit that referenced this issue Sep 22, 2014
…allow non-decorated output (kbond)

This PR was merged into the 2.6-dev branch.

Discussion
----------

[Console] add overwrite flag to ProgressBar helper to allow non-decorated output

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes, but not critical
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11542, #10011
| License       | MIT
| Doc PR        | symfony/symfony-docs#4206

By default, the `ProgressBar` helper overwrites the output to give the nice progress bar look.  To prevent the output from blowing up in non-decorated environments, the output was hidden in these environments (see #9846).

This PR enables using the `ProgressBar` in non-decorated environments by adding an `overwrite` flag.  When `false`, instead of overwriting the bar, it is rendered on a new line.  To prevent flooding the output, you can adjust the `redrawFrequency`.

By default, when using the `ProgressBar` in a non-decorated environment, the `overwrite` flag is set to false.  If a `max` is set, the `redrawFrequency` is set to a sensible default (10% of the max).  If a `max` isn't set, the bar is output for every advance so to prevent flooding, a sensible `redrawFrequency` should be manually set.

The only BC break is that output will now display where it didn't before.

Commits
-------

cdee6f6 add overwrite flag to allow non-decorated output
@fabpot fabpot closed this as completed Sep 22, 2014
@andig
Copy link
andig commented Oct 1, 2014

As this is a bug- can it be backported to 2.5?

@wouterj
Copy link
Member
wouterj commented Oct 1, 2014

It's not a bug imo. It was disabled in windows by design.

@andig
Copy link
andig commented Oct 1, 2014

It's not a bug imo. It was disabled in windows by design.

I was using it on 2.4 just fine. This is like saying 'we don't support mysql anymore by design'. I would highly appreciate if it could make its way into 2.5.

@dedalozzo
Copy link

It is instead, it doesn't work on Mac OS X either.

On Oct 1, 2014, at 1:14 PM, Wouter J wrote:

It's not a bug imo. It was disabled in windows by design.


Reply to this email directly or view it on GitHub.

@andig
Copy link
andig commented Oct 3, 2014

Btw. when progressbar appears (e.g. with 2.6.*-dev), it should display a CRLF on progress->finish(). Otherwise the application will need to know of progress bar was displayed or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants
0