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

Ability to force color #271

Merged
merged 1 commit into from
Jul 23, 2015
Merged

Ability to force color #271

merged 1 commit into from
Jul 23, 2015

Conversation

sbmaxx
Copy link
Contributor

@sbmaxx sbmaxx commented Jul 19, 2015

We may need it if running via shelljs for example.

We may need it if running via `sheel.js` for example.
@levonet levonet added the review label Jul 19, 2015
@blond
Copy link
Member

blond commented Jul 20, 2015

/сс @tormozz48 @SwinX

@@ -26,7 +26,7 @@ var styles = {
'bgDefault': ['\033[49m', '\033[49m']
};

var enabled = !process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2);
var enabled = process.env.COLOR || (!process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2));
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems in this line checks about file descriptors point to TTY are being ignored if process.env.COLOR is being set. This may lead to case when color output may occur, for example, in log file. Looks like this is not a correct behavior, output anywhere expect TTY has to be clean, without colors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you set process.env.COLOR variable, you should know what you're doing.

@sbmaxx
Copy link
Contributor Author

sbmaxx commented Jul 20, 2015

@SwinX i'm trying to get this code works:

var exec = require('child_process').exec,
    child;
child = exec('enb make', { stdio: 'inherit' });

child.stdout.on('data', function(data) {
    console.log(data);
});

Any suggestions?

@sbmaxx
Copy link
Contributor Author

sbmaxx commented Jul 20, 2015

Sure, i can do smth like this:

var make = require('enb/lib/server/server-middleware').createBuilder({
    cdir: process.cwd()
});
make(path);

but i think it's not right ;)

@blond
Copy link
Member

blond commented Jul 20, 2015

@sbmaxx you can use JS API since v0.15.0:

var enb = require('enb');

enb.make(['path/to/target-1', 'path/to/target-2']);

See https://github.com/enb-make/enb/blob/master/lib/api/make.js#L6-L20 and https://github.com/enb-make/enb/blob/master/lib/api/run-server.js#L5-L19

This is what you need?

@blond blond added ready and removed review labels Jul 21, 2015
@SwinX
Copy link
Contributor

SwinX commented Jul 23, 2015

After further discussion if was decided to merge.

SwinX added a commit that referenced this pull request Jul 23, 2015
@SwinX SwinX merged commit 6de8690 into enb:master Jul 23, 2015
@SwinX SwinX removed the ready label Jul 23, 2015
@blond
Copy link
Member

blond commented Aug 1, 2015

Fixed in v0.17.0

@sbmaxx
Copy link
Contributor Author

sbmaxx commented Aug 1, 2015

🎉

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.

4 participants