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

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

Open
1 of 3 tasks
NiceGuyIT opened this issue Apr 3, 2024 · 5 comments
Open
1 of 3 tasks

Comments

@NiceGuyIT
Copy link
Contributor

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
@wh1te909
Copy link
Member

wh1te909 commented Apr 3, 2024

Have to set the following in config.nu

$env.config = {
  use_ansi_coloring: false
}

chrome_Dn6rtU6yBe

@wh1te909
Copy link
Member

wh1te909 commented Apr 3, 2024

should probably just enable this by default

@P6g9YHK6
Copy link

P6g9YHK6 commented Apr 5, 2024

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

@NiceGuyIT
Copy link
Contributor Author

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

@P6g9YHK6
Copy link

P6g9YHK6 commented Apr 9, 2024

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

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

3 participants