The readme states:
You have to install gzip, libarchive, tar, wget, ncurses, and less executables. Go to
http://gnuwin32.sourceforge.net/packages.html and install the packages.

However, a ncurses package for windows does not exist? It is not listed on http://gnuwin32.sourceforge.net/packages.html.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greg.1.anderson’s picture

Category: support » bug
Issue tags: +Windows

The ncurses requirement comes from the cygwin side. From the drush script:

# Note to cygwin users: install the ncurses package to get tput command.

If you are using drush.bat, you do not need ncurses. The documentation could use updating to explain this.

greg.1.anderson’s picture

Note, however, that without ncurses, drush does not know how to determine the width of the console.

On the DOS prompt, the console does not seem to get much larger than 84 columns, so drush's default of 80 works pretty well most of the time.

In Powershell, (Get-Host).UI.RawUI.WindowSize will return the width and height of the console. It would be necessary to create a drush cmdlet to utilize this.

I don't know how to get the console width in msysgit. stty size is another way to get the screen size in Linux, but this command is not available in MINGW either.

greg.1.anderson’s picture

Title: readme text for windows: no win32 ncurses binary exists » Determining the number of columns on Windows

So, the point is that we should update the README and either say how this works, or document that it does not work.

Note that stty size does exist in cygwin, so perhaps we should use this instead of tput. Note, however, that I am not sure which cygwin package stty is included in.

greg.1.anderson’s picture

pdcurses, mentioned in #1154380: Typo in README - Windows Installation, might help out here.

alexanderpas’s picture

The width of the console in MS-DOS can be determined from the output of the mode con command.

greg.1.anderson’s picture

Thank you! This also works in Powershell, so #2 is not necessary. That still leaves mingw uncovered; perhaps we will use pdcurses there.

beltofte’s picture

Not sure if it's relevant anymore, byt stty size is included in the sh-utils cygwin package, see http://cygwin.com/cgi-bin2/package-grep.cgi?grep=sh-utils.

beltofte’s picture

Have made a patch exporting columns for CMD and PowerShell on Windows. It only works on PHP 5.3.0 and later. On previous PHP versions is columns always exported as 80. Guess the reason is that exec() starts a new CMD with the default settings.

PS C:\Program Files (x86)\PHP\v5.3> mode con

Status for device CON:
----------------------
    Lines:          3000
    Columns:        140
    Keyboard rate:  31
    Keyboard delay: 1
    Code page:      850

PS C:\Program Files (x86)\PHP\v5.3> .\php.exe C:\inetpub\wwwroot\test.php
PHP 5.3.8
Array
(
    [0] =>
    [1] => Status for device CON:
    [2] => ----------------------
    [3] =>     Lines:          3000
    [4] =>     Columns:        140
    [5] =>     Keyboard rate:  31
    [6] =>     Keyboard delay: 1
    [7] =>     Code page:      850
    [8] =>
)
PS C:\Program Files (x86)\PHP\v5.3> php.exe C:\inetpub\wwwroot\test.php
PHP 5.2.17
Array
(
    [0] =>
    [1] => Status for device CON:
    [2] => ----------------------
    [3] =>     Lines:          300
    [4] =>     Columns:        80
    [5] =>     Keyboard rate:  31
    [6] =>     Keyboard delay: 1
    [7] =>     Code page:      850
    [8] =>
)
PS C:\Program Files (x86)\PHP\v5.3>
greg.1.anderson’s picture

Status: Active » Needs work

That's a good start. Perhaps we should be more pragmatic about our column checking: rather than assuming that drush_is_cygwin will correctly determine whether stty is installed, just try to run 'stty size'. If the command fails and drush_is_windows is true (and php > 5.3.0 or later), then try 'mode con'.

beltofte’s picture

Refactored the column checking. It now starts checking with "stty size" and if that fails and we are running on Windows and PHP 5.3.0 or later, are it trying with "mode con". Finally is it falling back to 80 columns if none of the checks succeeded.

greg.1.anderson’s picture

Assigned: Unassigned » greg.1.anderson
Status: Needs work » Needs review

Code looks good. Now I've got two patches to test on Windows...

beltofte’s picture

Thanks, Greg :-)

greg.1.anderson’s picture

Status: Needs review » Fixed

Works great; good improvement. Committed.

Status: Fixed » Closed (fixed)
Issue tags: -Windows

Automatically closed -- issue fixed for 2 weeks with no activity.