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

output is not shown when using through `watch` #21

Closed
mightyiam opened this issue Feb 4, 2015 · 14 comments

Comments

@mightyiam
Copy link
Contributor

commented Feb 4, 2015

Thanks for this.

I'm using it as such:

{
  "name": "foo",
  "devDependencies": {
    "watch": "^0.13.0",
    "standard": "*",
    "jasmine": "^2.2.0"
  },
  "scripts": {
    "watch": "watch 'npm test'",
    "test": "standard && jasmine"
}

When I run $ npm test all is well and as expected.

The issue comes when I use watch, such as $ ./node_modules/.bin/watch 'npm test' or $ npm run watch.

The output from standard is not printed. I know that standard runs because jasmine's output is printed.

Do you think that watch is doing something wrong?

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 4, 2015

I've just tried with $ dirwatch -vc standard and $ onchange 'somefile' -- standard. No output. Perhaps standard is throwing to wrong output?

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Feb 4, 2015

possibly related: piping through grep doesn't filter.

standard | grep variable
@feross

This comment has been minimized.

Copy link
Member

commented Feb 5, 2015

standard prints to stderr. I'm not sure what the convention is for these things. Should it print to stdout instead?

@mafintosh

This comment has been minimized.

Copy link
Contributor

commented Feb 5, 2015

i think it should keep printing to stderr since its normal to do stuff like standard && tape test.js. otherwise it would mess up a tap parser (like npm test | tap-spec)

you can always just run

standard 2>&1 | grep variable
@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2015

@mafintosh ah, that makes sense. Didn't know grep was so picky with its input, hah. Thanks for explaining!

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2015

Added a PR that adds the explanation to the FAQ. Pretty sure this is also the reason watchify is failing for @mightyiam. Hope it'll resolve this issue.

@mafintosh

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2015

@yoshuawuyts typing random chars in bash fixes most problems 👍

@yoshuawuyts

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2015

@mafintosh you might've just fixed life itself 👏👏👏

@feross feross closed this in #29 Feb 6, 2015

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2015

I'm observing that the standard behavior is to output to stdout and not to stderr.

Try it like this:

Clone standard.

git clone feross/standard
cd standard
npm i

Make a non–standard JS file.

echo ';\n ;' > nonstandard.js

Run ESLint and JSCS on the non–standard JS file, redirecting stdouts to files.

./node_modules/eslint/bin/eslint.js -c rc/.eslintrc nonstandard.js 1> eslint-stdout
./node_modules/jscs/bin/jscs -c rc/.jscsrc nonstandard.js 1> jscs-stdout

Observe that no output was printed. This means stderr wasn't used.
See that stdout was used.

cat jscs-stdout
cat eslint-stdout

Try the same with our beloved standard.

./bin/cmd.js 1> standard-stdout
cat standard-stdout

So it seems that the standard is to print to stdout.

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2015

Unless, of course, standard experiences an actual error—like bad arguments or not finding its dependencies or something.

@feross

This comment has been minimized.

Copy link
Member

commented Feb 7, 2015

@mightyiam You make a good point.

@maxogden Do you have any thoughts?

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 13, 2015

BTW, I've switched to npm-watch, because of the integration with package.json. It is just "how it is done".

@feross

This comment has been minimized.

Copy link
Member

commented Feb 20, 2015

Going to close this issue as it doesn't seem to be causing trouble for anyone anymore. Feel free to make a new issue or leave a comment if that's not true.

@feross feross closed this Feb 20, 2015

@mightyiam

This comment has been minimized.

Copy link
Contributor Author

commented Feb 20, 2015

Since vim-syntastic/syntastic@c1a2098 I have it in my editor so I'm not using watch or npm-watch so I'm not affected by this anymore.

If you're not in a hurry to fix it, that's ok but it seems to me that this issue should at least be kept open.

@lock lock bot locked as resolved and limited conversation to collaborators May 11, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
4 participants
You can’t perform that action at this time.