There's a [strange recurring error][CI-4] that occurs on various tests of 
HooksRunner.spec only on AppVeyor/Node 6. The first error message is usually 
`'W@@H' is not recognized as an internal or external command, operable 
program or batch file.` The first string varies.

It turns out this is caused by faulty shebang detection. The below part of 
`extractSheBangInterpreter` will try to read 4 KiB into an uninitialized 
buffer. It then disregards the number of bytes read and transforms the whole 
buffer contents to a string. If, for whatever reason, `fs.readSync` should 
return `0` and the first two bytes of the buffer happen to be `#!` then the 
code would detect a garbage shebang and above error would occur.
https://github.com/apache/cordova-lib/blob/25ce9089b7e3fb5d362175fdb540605678c7b2fe/src/hooks/HooksRunner.js#L245-L247

Side note: great example of why it is bad to ignore linter warnings.

[CI-4]: 
https://ci.appveyor.com/project/ApacheSoftwareFoundation/cordova-lib/build/1.0.1415/job/gq0h4096n2qfdo10#L1653

[ Full content available at: https://github.com/apache/cordova-lib/issues/653 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to