Open mikestopcontinues opened 6 years ago
For some weird reason this is fixed by appending --color
to the command. E.g.
forever --minUptime=5000 --spinSleepTime=5000 ./index.js --color
I ended up switching to nodemon for dev and pm2 for deploy. But that rocks, @RickWong. Thanks!
Thank you. I had same problem. Just a reminder: It has to be last parameter (flag).
Why it has to be --color instead documentation mentioned --colors? (with --color at the end it works but with --colors doesn't)
Because most projects use the colors
package, and this is the source: https://github.com/Marak/colors.js/blob/9f3ace44700b8e705cb15be4767845c311b3ae11/lib/system/supports-colors.js#L34-L38
(--color
returns early and therefore overrides any tty/cli/shell/forever/nodemon detections that are on the lines below it.)
So README.md should be changed here from --colors to --color or not? because it doesn't seem to work as --colors.
Because i'm confused who's actually "consumes" this parameter. Is it forever or command executed by forever or colors library itself
If this parameter has nothing to do with forever and it's just passed to internal library colors then forever documentation should be consistent with this. Isn't it?
Any script like forever, supervisor, just "nohup" or only redirect stdout and stderr to any file or tty make colours output (colours module for colours console.log) "color-clear". Parameter "--colors" for forever makes nothing change for me, but "--color" (with forever script) as last parameter makes colours console.log works to aby outputs (file, tty, std redirection...). It has effect on "fs.appendFileSync" of any colors output also ...
Colors library only add "special text code" part before and after of output text for swith-on and awitch-off colors.
It's looks that is a problem of redirection of stdout (but it effect on fs.appendFileSync too). I don't know who filter colors output, but "--colors" parameter (as last one) works :) ... and thanks for it.
Workaround:
FORCE_COLOR=1 forever start foo.js
It is premised that you are coloring with chalk.
Setting this in my script worked for me:
process.stdout.isTTY = true
Forever seems to strip the colors from the running script, regardless of using the
--colors
flag. This issue has been raised before and closed without solution.Running osx 10.13.2, node 9.2.0, latest forever release, in iTerm2, though the colors don't work in Terminal either.