besom.internal.ResourceDecoder fails to parse some escape codes
//> using scala "3.3.3"
//> using options -Werror -Wunused:all -Wvalue-discard -Wnonunit-statement
//> using dep "org.virtuslab::besom-core:0.3.1"
//> using dep "org.virtuslab::besom-command:0.10.0-core.0.3"
import besom.*
import besom.api.command
@main def main = Pulumi.run {
val run = command.local.Command(
"test-command",
command.local.CommandArgs(
create = """echo -e "normal text here \n\x1b[0;1;31m this text should be bold and red""""
)
)
Stack.exports(
stdout = run.stdout
)
}
pulumi up fails with
2024.05.07 00:02:40:797 scala-execution-context-global-52 [resource: test-command[command:local:Command]] ERROR besom.internal.ResourceDecoder.resolve:97
Resolve resource: received error from gRPC call: 'Unknown ansi-escape [0;1;31m at index 21 inside string cannot be
parsed into an fansi.Str', failing resolution
2024.05.07 00:02:40:844 main ERROR besom.internal.BesomModule.run:70
java.lang.IllegalArgumentException: Unknown ansi-escape [0;1;31m at index 21 inside string cannot be parsed into an
fansi.Str
Thank you for this report! I'm wondering if this is hiding another issue as we don't really use fansi in contexts different than debugging and error handling. I'll investigate.
Ok, so this is a much bigger problem than just fansi having issues with parsing some escape codes. It seems Pulumi engine does something to escape codes and even if I disable trace logging that leads to this exception the besom program does not terminate at all in your sample. I guess something goes horribly wrong on pulumi's side but I'm still researching.
Ha, problem is on our side (in fansi and our pretty printer). I have a solution that works.
fixed in #492