diff --git a/lib/XMLHttpRequest.js b/lib/XMLHttpRequest.js index 4b7cab4..ec7d7a6 100644 --- a/lib/XMLHttpRequest.js +++ b/lib/XMLHttpRequest.js @@ -482,7 +482,10 @@ exports.XMLHttpRequest = function() { + (data ? "req.write('" + JSON.stringify(data).slice(1,-1).replace(/'/g, "\\'") + "');":"") + "req.end();"; // Start the other Node Process, executing this string - var syncProc = spawn(process.argv[0], ["-e", execString]); + var statusText; + var syncProc = (process.execPath == "node") + ? spawn(process.execPath, ["-e", execString]) + : spawn("/usr/bin/env", ["node", "-e", execString]); var statusText; while(fs.existsSync(syncFile)) { // Wait while the sync file is empty