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

Terminal colors #119

Merged
merged 7 commits into from
Feb 21, 2024
Merged

Conversation

deribaucourt
Copy link
Member

No description provided.

@deribaucourt
Copy link
Member Author

deribaucourt commented Feb 19, 2024

node-pty will be used to provider a better interactive terminal.
It's required to have colors and progress bars from bitbake.
Explanation: microsoft/vscode#155444 (comment)

However, VSCode uses electron which has it's own npm
NODE_MODULE_VERSION. I had to use @electron/rebuild to match the
version. I wonder if it would break when VSCode updates electron.
** UPDATE ** I used dynamic imports instead which work more reliably

There are discussions which failed to provide other workarounds
(we don't use webpack yet):

The format of the files and package-lock.json where updated by npm
install.

@deribaucourt deribaucourt marked this pull request as ready for review February 20, 2024 13:36
@deribaucourt
Copy link
Member Author

image
shiny error colors!

Copy link
Contributor

@WilsonZiweiWang WilsonZiweiWang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! I wonder if we could show only one progress bar in the terminal.
image

There are 3rd party packages that do this. But it is a minor and low priority.

node-pty will be used to provider a better interactive terminal.
It's required to have colors and progress bars from bitbake.
Explanation: microsoft/vscode#155444 (comment)

However, VSCode uses electron which has it's own npm
NODE_MODULE_VERSION. I had to use `@electron/rebuild` to match the
version. I wonder if it would break when VSCode updates electron.

There are discussions which failed to provide other workarounds
(we don't use webpack yet):
 - microsoft/node-pty#582
 - microsoft/vscode#658

The format of the files and package-lock.json where updated by npm
install.
Following the representation from microsoft/vscode#155444 (comment)

This allows colors and progress bars to render from bitbake.
Compared to child_process.spawn, the stdout data buffer from node-pty
ends lines with \n instead of \r\n. We must update all our regexes and
splits.

The regex make \r so that we avoid potential compatibility issues.
We'll be using dynamic imports instead to comply with both the vscode
and native jest environments.
VSCode and the Jest native environment use conflicting
NODE_MODULE_VERSION. We have to use node-pty from VSCode
when running in the VSCode environment and the regular
node-pty when running in Jest.

Following the idea presented in:
microsoft/vscode#658 (comment)
We use dynamic imports to load the correct node-pty.

The types must still be imported normally at compile time.
 - Update import paths for ProcessUtils
 - Update newline from \n to \r\n
 - Update function names for onData and onExit
node-pty was truncating the output of the `ps` command, which was causing
the `ps` command to not return the expected output. In turn, bitbake
processes were not being detected and stopped on terminal close.
@deribaucourt deribaucourt merged commit 9359486 into yoctoproject:staging Feb 21, 2024
2 checks passed
@deribaucourt deribaucourt deleted the terminal-colors branch February 21, 2024 09:04
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

Successfully merging this pull request may close these issues.

2 participants