crystal-loot / nox

Procfile-based process manager written in Crystal
MIT License
17 stars 2 forks source link

Coloring difference between nox and overmind #1

Open jwoertink opened 2 years ago

jwoertink commented 2 years ago

Here's what Nox looks like when I boot my app

Screen Shot 2021-12-29 at 8 44 01 AM

Here's what Overmind looks like

Screen Shot 2021-12-29 at 8 46 18 AM

There's a few differences here:

matthewmcgarvey commented 2 years ago

I think it might be connected to the fact that Overmind uses PTY (pseudo-terminals) which causes the command to think it's outputting to the terminal, while Nox does not so the command thinks it's outputting to a file. I would like for it to look no different than Overmind's output, but Crystal doesn't have a library that implements PTY right now.

https://evilmartians.com/chronicles/introducing-overmind-and-hivemind

You could verify this by running it with foreman since it doesn't use PTY either and compare the output.

There might be some stuff that isn't attributed to this, though. Like the yarn run ... thing. I'll try to look into it.

jwoertink commented 2 years ago

Ah cool. Yup. Tried with foreman, and it looks the same. I'm cool with how it looks, I just wanted to make sure we weren't losing out on something. I did try doing some puts "***".colorize.yellow and it came out fine, so we're at least catching that.

matthewmcgarvey commented 2 years ago

Yep, pretty sure it only affects utilities that have different output styling based on what it's outputting to. The article's example is Sidekiq. The article also mentions that there could be lag with a lot of output, but I'm sure it will be fine 😟

matthewmcgarvey commented 1 month ago

It's weird coming back to this issue, checking to see if there are any PTY shards out there yet, finding one and thinking "ahh, but it's kinda old" and then realizing that it's newer than this conversation we had almost 3 years ago.

Anyways: https://github.com/crystal-posix/pty.cr might be helpful