-
Notifications
You must be signed in to change notification settings - Fork 62
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
Preserve colors in output? #65
Comments
For most commands, you can find a way to force it to colorize the output (e.g. |
Hmm that's different from what I'm seeing. I have a simple script that uses var paths = {
js: {
index: 'index.js'
}
}
gulp.task('run-index', function () {
return gulp.src(paths.js.index, {read: false})
.pipe(shell([
'node <%= file.path %>'
]))
}) |
I don't know why |
Hi @sun-zheng-an, I agree with the request from @mhkeller for the preservation of colors in the output. For example, my Karma config is configured with But when i run this through gulp-shell module, it does not output the same expected colors, especially when configured through Karma config. This should rule out the fact that Karma itself is stripping the colours because a direct shell command shows the colors fine, and is correctly configured in the Karma configuration file. I believe However according to NodeJS docs the other child_process instances do provide that option such as Any thoughts on a way around this? Want to consider using Preservation of colours would provide improved readability! |
@mhkeller no worries. Given your link, yes, that looks to be the only line the Now, i no longer rely on gulp-shell (so no need to fork) for what I am doing (since yesterday). I am now just using the following code to run shell commands natively through node's own module, using the spawn method var spawn = require('child_process').spawn;
gulp.task('test', function (callback) {
var ls = spawn('karma', ['start', 'karma.conf.js'], {stdio: 'inherit'});
ls.on('close', function (code) {
console.log('child process exited with code ' + code);
// Important to invoke the callback on close for Gulp to finish task correctly
callback();
});
}); |
@sun-zheng-an unfortunately I don't use chalk, or any other module dependency specific to the task of colorising the output of the shell, as It's not necessary. My requirement is simple, which is to output the same colors 'as-is', like when running the same command directly in a shell, but this time through a wrapper module like gulp-shell, etc. But gulp-shell is unable to satisfy such a requirement at the current moment in time unfortunately. |
@Sayvai |
@sun-zheng-an sure, agreed. As i mentioned in one of the other previous posts, it's really specifically the Given that information, gulp-shell is dependent and currently wrapping around the use of |
@Sayvai Do you mean even if your command print out some colors, |
@sun-zheng-an well, in practise, yes. the output appears not to preserve colors from the point of running shell commands against However, the below listed
Read up on the NodeJS docs for these methods, and play around. If you can find a way of preserving colors using |
IMHO, that's not the fact. Please try (or something like
|
👍 I would love to have this |
@Sayvai is correct, |
+1 |
in params add:
|
I just released |
I'm executing a node script with
node index.js
but gulp-shell doesn't preserve colors in stdout. It would be helpful to keep them in if possible.The text was updated successfully, but these errors were encountered: