I am looking for a platform independent (win, mac, linux) way of finding whether a file is executable or not. Following doesn't work for me (not even on linux) -
var spawn = require("child_process").spawn;
var proc = spawn("whatever file");
proc.stderr.on('data', function (data) {
if (/^execvp\(\)/.test(data)) {
console.log('Failed to start child process.');
}
});