crc-org / crc

CRC is a tool to help you run containers. It manages a local OpenShift 4.x cluster, Microshift or a Podman VM optimized for testing and development purposes
https://crc.dev
Apache License 2.0
1.25k stars 236 forks source link

The command `crc status -w` on Windows writes out escape codes #3936

Closed jeffmaury closed 8 months ago

jeffmaury commented 9 months ago

General information

CRC version

CRC version: 2.28.0+e1f42d
OpenShift version: 4.13.14
Podman version: 4.4.4

CRC status

DEBU CRC version: 2.28.0+e1f42d
DEBU OpenShift version: 4.13.14
DEBU Podman version: 4.4.4
DEBU Running 'crc status'
CRC VM:          Running
OpenShift:       Starting (v4.13.14)
RAM Usage:       5.859GB of 9.361GB
Disk Usage:      19.41GB of 32.68GB (Inside the CRC VM)
Cache Usage:     29.51GB
Cache Directory: C:\Users\Jeff\.crc\cache

CRC config

- consent-telemetry                     : yes

Host Operating System


Nom de l'h鍍e:                              DESKTOP-JEFF
Nom du syst確e d'exploitation:              Microsoft Windows 11 Professionnel
Version du syst確e:                         10.0.22621 N/A build 22621
Fabricant du syst確e d'exploitation:        Microsoft Corporation
Configuration du syst確e d'exploitation:    Station de travail autonome
Type de build du syst確e d'exploitation:    Multiprocessor Free
PropriUaire enregistr・                    Jeff MAURY
Organisation enregistrF:                   
Identificateur de produit:                  00330-80819-37372-AA576
Date d'installation originale:              09/11/2022, 16:39:06
Heure de dNarrage du syst確e:              04/12/2023, 15:54:02
Fabricant du syst確e:                       LENOVO
Mod獲e du syst確e:                          20TJS2F43N
Type du syst確e:                            x64-based PC
Processeur(s):                              1 processeur(s) install・s).
                                            [01]: Intel64 Family 6 Model 165 Stepping 2 GenuineIntel ~2310 MHz
Version du BIOS:                            LENOVO N2VET29W (1.14 ), 15/03/2021
RQertoire Windows:                         C:\Windows
RQertoire syst確e:                         C:\Windows\system32
PSiphSique d'amor㌢ge:                    \Device\HarddiskVolume1
Option rHionale du syst確e:                fr;Fran㌢is (France)
Param閣res rHionaux d'entrF:              fr;Fran㌢is (France)
Fuseau horaire:                             (UTC+01:00) Bruxelles, Copenhague, Madrid, Paris
MNoire physique totale:                    32525 Mo
MNoire physique disponible:                10370 Mo
MNoire virtuelle: taille maximale:        45586 Mo
MNoire virtuelle: disponible:             19831 Mo
MNoire virtuelle: en cours d'utilisation: 25755 Mo
Emplacements des fichiers d'Dhange:        C:\pagefile.sys
Domaine:                                    WORKGROUP
Serveur d'ouverture de session:             \\DESKTOP-JEFF
Correctif(s):                               4 Corrections installFs.
                                            [01]: KB5032007
                                            [02]: KB5012170
                                            [03]: KB5032190
                                            [04]: KB5032393
Carte(s) rTeau:                            5 carte(s) rTeau installF(s).
                                            [01]: Intel(R) Wi-Fi 6 AX201 160MHz
                                                  Nom de la connexion: Wi-Fi
                                                  DHCP activ・:         Oui
                                                  Serveur DHCP:        192.168.1.254
                                                  Adresse(s) IP
                                                  [01]: 192.168.1.187
                                                  [02]: fe80::5102:6cd:7e09:85b2
                                                  [03]: 2a01:e34:ec7e:3020:349b:1d9d:c826:b6f4
                                                  [04]: 2a01:e34:ec7e:3020:5116:66ca:8d7a:292a
                                            [02]: Bluetooth Device (Personal Area Network)
                                                  Nom de la connexion: Connexion rTeau Bluetooth
                                                  腎at:                Support dDonnect・
                                            [03]: Wintun Userspace Tunnel
                                                  Nom de la connexion: OpenVPN Wintun
                                                  腎at:                Support dDonnect・
                                            [04]: TAP-Windows Adapter V9
                                                  Nom de la connexion: OpenVPN TAP-Windows6
                                                  腎at:                Support dDonnect・
                                            [05]: OpenVPN Data Channel Offload
                                                  Nom de la connexion: OpenVPN Data Channel Offload
                                                  腎at:                Support dDonnect・
Configuration requise pour Hyper-V:         Un hyperviseur a U・dUect・ Les fonctionnalitT nDessaires ・Hyper-V ne seront pas affichFs.

Steps to reproduce

  1. crc start
  2. crc status -w

Expected

Actual

daemon

Logs

Before gather the logs try following if that fix your issue

$ crc delete -f
$ crc cleanup
$ crc setup
$ crc start --log-level debug

Please consider posting the output of crc start --log-level debug on http://gist.github.com/ and post the link in the issue.

anjannath commented 9 months ago

@jeffmaury does it behave the same in the powershell window as well or this happens only in the windows terminal app?

gbraad commented 9 months ago

These are escape codes (that are not interpreted correctly. And as it looks like, you are running the command prompt cmd instead of powershell.

I do not think this is a situation with a high priority, as crc status works otherwise perfectly.

jeffmaury commented 9 months ago

daemon1

gbraad commented 9 months ago

@anjannath how about Mac?

anjannath commented 9 months ago

in macOS its fine, escape codes are being rendered properly..

Image

gbraad commented 9 months ago

So it is the color. Perhaps a solution could be to make it all colorless or not for GOOS=Windows

/cc: @evidolob WDYT?

evidolob commented 9 months ago

Yes we could do that, perhaps, even detect if terminal supports color, and add only if terminal supports colours

evidolob commented 9 months ago

It seems that Windows 10(from build 10586) does support colours in terminal, we need to enable it. We could use https://github.com/jwalton/go-supportscolor to add detection of color support on any supported OS, lib will also enable color support on windows.

@gbraad WDYT?

cfergeau commented 9 months ago

https://github.com/crc-org/crc/blob/main/pkg/os/terminal/terminal.go provides support to check if we run in a terminal or not, this could be extended to check if color output is supported.

gbraad commented 9 months ago

@evidolob add a check to see if color support is available. We can otherwise use an override structure with _windows.go if not working as expected.

Note: this is low priority and perhaps something @vyasgun can do?

vyasgun commented 9 months ago

/assign

vyasgun commented 8 months ago

When I sent a ctrl-c after the bars start printing, I could see the expected output: image

The problem seems to be with the progressbar pool as I am not running into this when I am printing the progress bar independently.

anjannath commented 8 months ago

fixed in #3955