stevieb9 / berrybrew

Perlbrew for Windows!
Other
63 stars 9 forks source link

Issue with File Associations #244

Closed gerlinl closed 3 years ago

gerlinl commented 4 years ago

When running a perl command from a cmd prompt, no results are displayed until I push \<ENTER> a second time.

For example I have a simple test script that list the perl info and displays the first passed argument:

#!/usr/bin/perl
use strict;
use warnings;

print "-------------------------------\n";
print "Version: ";
print $^V . "\n";
print "Path: ";
print $^X . "\n";
print "ARGV[0]: $ARGV[0]\n";
print "-------------------------------\n";

exit 0;

When it is run from a command prompt I get this:

W:\>v.pl test

W:\>

The curser is blinking after the second W:> just like it has completed.

However if I push \<ENTER> again, I see the results of the script:

W:\>v.pl test

W:\>
W:\>-------------------------------
Version: v5.18.4
Path: C:\perlroot\5.18.4_64\perl\bin\perl.exe
ARGV[0]: test
-------------------------------

I then need to push \<ENTER> again to get back to a command prompt.

If I unset the association feature this does not happen (though of course the association is not handled within BB)

I don't think this would be expected behavior, it makes it difficult to run and test complicated scripts.

This is a new install of BB 1.31 on Windows 10 using the downloaded installer.

stevieb9 commented 3 years ago

I finally understand what's causing this issue, but only has of yet a couple of ideas on how to either fix it, or at least create a workaround. It shouldn't take me long to publish up a solution.

stevieb9 commented 3 years ago

Possible solutions:

stevieb9 commented 3 years ago

Tentative solution that appears to work, at least manually:

Another idea to think about is to hard code the absolute path in the reg value instead of the env var in Switch(). This way, a new prompt won't be required.