amidaware / tacticalrmm

A remote monitoring & management tool, built with Django, Vue and Go.

Home Page:https://docs.tacticalrmm.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Escape sequences (TERM?) for Nushell errors are not handled correctly

NiceGuyIT opened this issue · comments

Server Info (please complete the following information):

  • OS: Ubuntu 20.04.4 LTS
  • Browser: 115.8.0esr (64-bit)
  • RMM Version (as shown in top left of web UI): 0.18.0

Installation Method:

  • Standard
  • Standard with --insecure flag at install
  • Docker

Agent Info (please complete the following information):

  • Agent version (as shown in the 'Summary' tab of the agent from web UI): Agent v2.7.0
  • Agent OS: Windows 10 Pro

Describe the bug
When running a Nushell command, the output is nice. If there's an error, the escape sequences in the error are shown and the output looks horrible.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Script Manager and create a Nushell script
  2. Create a Nu script that has an error. See below for an example.
  3. Run the script on an agent to produce an error.
  4. See error with escape sequences.

Note: I may be able to fix this but it will take a few months before I get to it.

Expected behavior
I expect the escape sequences to be displayed correctly and get a nicely formatted error message.

Screenshots
image

Here's the text version of the same.

Error: �[31mnu::shell::directory_not_found�[0m

  �[31m�[0m Directory not found
   ╭─[�[36;1;4mC:\ProgramData\TacticalRMM\2779409457.nu�[0m:2:7]
 �[2m1�[0m │ version
 �[2m2�[0m │ ls -l sd
   · �[35;1m      ─┬�[0m
   ·        �[35;1m╰── �[35;1mdirectory not found�[0m�[0m
   ╰────
�[36m  help: �[0mC:\WINDOWS\TEMP\sd does not exist

Additional context
Here's an example Nu script.

version
ls -l sd
commented

Have to set the following in config.nu

$env.config = {
  use_ansi_coloring: false
}

chrome_Dn6rtU6yBe

commented

should probably just enable this by default

commented

In #1026 (comment)
I had added a line to the script to make ps7 behave properly there is maybe a similar non hard config for nushell

Fancy-ANSI converts ANSI sequences to HTML. They list a couple other libraries that do the same. Might be nice in the long run.

commented

found the solution in nushell/nushell#11847 nu need to be called with -l nushell/nushell#11847 (comment)

a pr is also coming with a script solution. nushell/nushell#11494