Open timjroberts opened 3 years ago
I believe the issue is that this library doesn't spawn with stdio: "inherit"
so the sub-processes dont get a TTY.
This function could be updated so that when shouldPrefix
is false
it switches to stdio: "inherit"
https://github.com/jamiebuilds/workspaces-run/blob/master/src/utils/spawn.ts#L50-L60
Happy to take a look and open a PR? Could possibly look at testing for a TTY too and if not present don't use inherit
. Keeps things clean in a CI setting.
Actually I think I've over thought this. If I add the --color
option to both eslint
and jest
for example, then the colours are being output. If the child process is already testing for the presence of a TTY and there isn't a way to give one to it (other than using inherit
), then there probably isn't much that can be done to force the child process to output its colours - other than using its command line options.
I think its safe to close this issue.
That's a good point. I have had tools get confused about having a TTY when they don't actually have one, and they end up doing things like prompting the user for input/etc.
Maybe a note about that in the README would be good. Could just list off common flags: FORCE_COLOR=true cmd
COLOR=true cmd
cmd --color
etc
With
yarn
andnpm@7
now supporting workspaces, and with monorepos becoming easier to manage because of it, packages like this are incredibly useful in helping to keep things really lean. I have a repo with several projects in it and I can now coordinate calls totsc
,eslint
andjest
all from the top level, even run my own scripts to perform other build related tasks.The only thing missing is colored output that the executing commands may be generating. Could this be added as a feature?