Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ammonite crashes when an string variable contains an escape character #1156

Open
DavidPerezIngeniero opened this issue Mar 8, 2021 · 0 comments

Comments

@DavidPerezIngeniero
Copy link

DavidPerezIngeniero commented Mar 8, 2021

If I paste this text into the Ammonite console, it crashes:

Welcome to the Ammonite Repl 2.3.8 (Scala 2.13.3 Java 1.8.0_282)
@ val ansi = "(?:\u001B\\[[0-9;]+m)?" 
ansi: String = "(?:\u001b\\[[0-9;]+m)?"

@ val reError = raw"$ansi(\d\d:\d\d:\d\d$ansi ${ansi}E\)$ansi (.*)".r 
Exception in thread "main" java.lang.IllegalArgumentException: Unknown ansi-escape \[[0-9;]+m)?(\d\d:\d\d:\d\d(?:[[0-9;]+m)? (?:[[0-9;]+m)?E\)(?:[[0-9;]+m)? (.*)
   at index 72 inside string cannot be parsed into an fansi.Str
	at fansi.ErrorMode$Throw$.handle(Fansi.scala:419)
	at fansi.ErrorMode$Throw$.handle(Fansi.scala:407)
	at fansi.Str$.apply(Fansi.scala:272)
	at fansi.Str$.implicitApply(Fansi.scala:227)
	at ammonite.repl.Repl$.$anonfun$showException$1(Repl.scala:304)
	at scala.collection.immutable.List.map(List.scala:246)
	at scala.collection.immutable.List.map(List.scala:79)
	at ammonite.repl.Repl$.showException(Repl.scala:300)
	at ammonite.repl.Repl$.handleRes(Repl.scala:258)
	at ammonite.repl.Repl.loop$1(Repl.scala:215)
	at ammonite.repl.Repl.run(Repl.scala:223)
	at ammonite.Main.$anonfun$run$1(Main.scala:223)
	at scala.Option.getOrElse(Option.scala:201)
	at ammonite.Main.run(Main.scala:211)
	at ammonite.MainRunner.$anonfun$runRepl$1(Main.scala:415)
	at ammonite.MainRunner.watchLoop(Main.scala:396)
	at ammonite.MainRunner.runRepl(Main.scala:415)
	at ammonite.Main$.main0(Main.scala:321)
	at ammonite.Main$.main(Main.scala:270)
	at ammonite.Main.main(Main.scala)

It even crashes one running as a script.

Environment:

  • Java 11
  • Linux
  • Ammonite 2.3.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant