6

On Windows 7 cmd.exe, the perl6-debug-m script outputs ansi escape sequences to set the colors, I suppose. How do I suppress these codes or at least make them functional? I'm just getting started with Perl 6 after working with Perl 4 and Perl 5 for over 20 years. I need this to work on Windows because of a program I'm trying to port from Perl 5.

C:\rakudo\bin\lib>perl6 -v
This is Rakudo Star version 2018.04.1 built on MoarVM version 2018.04.1
implementing Perl 6.c.

C:\rakudo\bin\lib>perl6-debug-m
←[35m>>> LOADING ←[0m<REPL 1>
←[34m+ <REPL 1> (1 - 1)←[0m
←[34m| ←[0m←[1;33mREPL←[0m
←[34m> ←[0mquit
←[34m- ←[0mRun END blocks (y/N)?

C:\rakudo\bin\lib>perl6 -V |grep -v "moar:"
distro::auth=unknown
distro::desc=2018-05-20T09:17:12.587605-04:00
distro::is-win=True
distro::name=mswin32
distro::path-sep=;
distro::release=unknown
distro::signature=
distro::version=6.3
kernel::arch=unknown
kernel::archname=unknown-win32
kernel::auth=unknown
kernel::bits=64
kernel::desc=
kernel::hardware=unknown
kernel::name=win32
kernel::release=unknown
kernel::signature=
kernel::version=unknown
perl6::build-date=2018-05-07T10:08:20Z
perl6::codename=
perl6::implementation=Rakudo Star
perl6::language_version=6.c
perl6::libdir=C:\rakudo\share
perl6::prefix=C:\rakudo
perl6::release-number=
perl6::source-digest=688d0872d150048d083b7a499e9fc7a9e8b6ab5b
perl6::version=2018.04.1
repo::chain=inst#C:\Users\danhale\.perl6 inst#C:\rakudo\share\perl6\site inst#C:\rakudo\share\perl6\vendor inst#C:\rakudo\share\perl6 ap# nqp# perl5#
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
Dan Hale
  • 91
  • 2
  • Can you use [powershell](https://learn.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell?view=powershell-6#finding-powershell-in-windows-10-81-80-and-7)? It seems to work well with ANSI, and [allow some configuration options](https://superuser.com/questions/1264444/using-ansi-escape-codes-in-powershell-prompt-to-add-color-looses-meaning-after) – jjmerelo May 20 '18 at 16:33
  • Thank you for the suggestion, but it didn't work for me. Under powershell the perl6-debug-m.bat script still outputs the escape sequences, not color changes. `C:\Users\danhale>powershell Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved. PS C:\Users\danhale> perl6-debug-m ←[35m>>> LOADING ←[0m ←[34m+ (1 - 1)←[0m ←[34m| ←[0m←[1;33mREPL←[0m ←[34m> ←[0m' – Dan Hale May 21 '18 at 18:56
  • you might need to install a program such as this one... https://github.com/adoxa/ansicon/ – jjmerelo May 21 '18 at 19:01

1 Answers1

5

There's currently no way to disable them (I just checked the debugger interface's source to verify that). I've previously used ANSICON on Windows in order to work with applications that produce ANSI color codes, including the Perl 6 debugger, and recall that it rendered them fine.

Jonathan Worthington
  • 29,104
  • 2
  • 97
  • 136
  • Thank you. That worked. I found I needed to run ansicon whenever a new command window is opened. I wrote a wrapper script p6db.cmd to do this every time, just in case. @ ANSICON.EXE c:\rakudo\bin\perl6-debug-m.bat "%*" – Dan Hale May 21 '18 at 18:54
  • Now that I've RTFM for ansicon :), I realize I can make it permanently apply to current and future invocations of cmd.exe by invoking it once with the -i flag. So there's no need for my p6db wrapper script. – Dan Hale May 22 '18 at 21:16