What is causing $CONSOLE->Attr to not work after capture_exec?
I use terminal color change to highlight errors during production tests.
The issue is that after I use "capture_exec" the colors no longer change. I'm assuming it has something to do with the execution of the code in another instance or something ?.?.
In the code below the output is
WHITE text color white
GREEN text color green
WHITE text color green
Thanks for the help you guys have saved by bacon a ton over the years
Matt-rookie
use strict; use warnings; use IO::CaptureOutput qw/capture_exec/; use Win32::Console; use vars qw($CONSOLE $attr); $CONSOLE = Win32::Console->new(STD_OUTPUT_HANDLE); $attr = $CONSOLE->Attr(); #get current console colors $CONSOLE->Attr($FG_WHITE | $BG_BLACK); #wht text on blk print "white\n"; $CONSOLE->Attr($FG_GREEN | $BG_BLACK); #grn text on blk print "green\n"; my ($stdout, $stderr, $success, $exit_code) = capture_exec( "dir" ); $CONSOLE->Attr($FG_WHITE | $BG_BLACK); #grn text on blk print "white\n";
In reply to IO::CaptureOutput Win32::Console compatibility by elmachin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |