Skip to content

Commit

Permalink
Default $*IN, $*OUT, $*ERR to utf8 encoding.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Feb 18, 2010
1 parent 84d6b02 commit 968011b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/cheats/setup-io.pm
@@ -1,15 +1,23 @@
# Really we should be able to write $PROCESS::IN := ...

INIT {
my $IN = IO.new(:PIO(pir::getstdin__P()));
my $OUT = IO.new(:PIO(pir::getstdout__P()));
my $ERR = IO.new(:PIO(pir::getstderr__P()));
Q:PIR {
$P0 = find_lex '$IN'
.local pmc IO
IO = get_hll_global 'IO'

$P0 = getstdin
$P0.'encoding'('utf8')
$P0 = IO.'new'('PIO'=>$P0)
set_hll_global ['PROCESS'], '$IN', $P0
$P0 = find_lex '$OUT'
set_hll_global ['PROCESS'], "$OUT", $P0
$P0 = find_lex '$ERR'

$P0 = getstdout
$P0.'encoding'('utf8')
$P0 = IO.'new'('PIO'=>$P0)
set_hll_global ['PROCESS'], '$OUT', $P0

$P0 = getstderr
$P0.'encoding'('utf8')
$P0 = IO.'new'('PIO'=>$P0)
set_hll_global ['PROCESS'], '$ERR', $P0

## Parrot doesn't give us the PID for now. Well, this file *is*
Expand Down

0 comments on commit 968011b

Please sign in to comment.