berrybrew icon indicating copy to clipboard operation
berrybrew copied to clipboard

Berrybrew should not proxy perl output

Open hurricup opened this issue 3 years ago • 4 comments

IRR currently berrybrew runs perl process and proxies output. But this may be tricky, have side-effects with buffering and pty. It probably should work like other version managers do: configure environment and run perl directly, replacing the berrybrew process with the perl one. Buffering problem may be illustrated with simple sample:

use v5.10;
say 'Enter your name';
my $name = <>;
say "Hello $name";

Running this with pty enabled (probably even without it) causes printing nothing before unrelying perl process ends. So you just type name, and then get:

entered_name
Enter your name
Hello entered_name

Also see https://github.com/Camelcade/Perl5-IDEA/issues/2438#issuecomment-1015744269

hurricup avatar Jan 18 '22 19:01 hurricup

I don't quite understand what you mean by "proxying output". Berrybrew simply modifies the environment the current perl process runs in. No calls to perl go through berrybrew. In some cases (for example berrybrew use ...) it will spawn a new system shell, but once that is done, berrybrew no longer has no impact.

In your example above, are you running that in the IDE or at the command line? If from the CLI, did you use berrybrew switch ... or berrybrew use ... to select the in-use perl?

stevieb9 avatar Jan 18 '22 20:01 stevieb9

It's berrybrew exec --with ...

hurricup avatar Jan 19 '22 05:01 hurricup

Hm. I was talking about things like https://github.com/dnmfarrell/berrybrew/commit/8524cfbdaad61088e60c0f4852ee416831dcee28#diff-c4b3df248657e6a617a988456b46d35aa2370a708e23dbd4b926df55d63283df But seems it's no longer there. I need to re-check if I have an up to date berrybrew, not the old one. Or probably Exec works in some strange way.

hurricup avatar Jan 19 '22 05:01 hurricup

Here is the code illustrating the difference between direct execution and execution via berrybrew exec(from terminal, cmd in my case):

use Term::ANSIColor;
use strict;
use warnings;
use v5.10;

say "Stdin tty: ".(-t STDIN ? 'yes': 'no');
say "Stdout tty: ".(-t STDOUT ? 'yes': 'no');
say "Stderr tty: ".(-t STDERR ? 'yes': 'no');
print color('bold blue');
print "This text is bold blue.";
say color('reset');
say "This text is normal.";
say colored("Yellow on magenta.", 'yellow on_magenta');
say "This text is normal.";

berrybrew 1.36

image

hurricup avatar Jan 19 '22 07:01 hurricup