I'm having a problem with a .cmd script only occasionally passing it's output through a pipe. The script is auto generated by npm and it runs jshint using node. Here's the script:

:: Created by npm, please don't edit manually.
@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\node_modules\jshint\bin\hint" %*
) ELSE (
  node  "%~dp0\node_modules\jshint\bin\hint" %*

Calling this script as jshint test.js always produces the desired output. However, it seems to not always get passed via a pipe. For example, jshint test.js | cat only produces output perhaps 10% of the time. Interestingly, jshint test.js > .jshintjunk & type .jshintjunk | cat works fine, but I'd rather not have the intermediate file.

Any idea how I can resolve this?


Try this:

echo. | jshint test.js | cat

That also happened to me and I solved it passing echo..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.