google/tracing-framework

Node trace files not generated on windows 7 64bit

pflannery opened this issue · 1 comments

When running wtf-trace a mingw32 file is generated but no wtf-trace file?
I also get the following error message:

fs.js:427
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory 'F:\github\pflannery\testproject\administrator:-c:\windows\system32\cmd.exe-wtf-trace-node_modules\docpad\out\bin\docp
ad.js-generate-20131110T052449.wtf-trace'
    at Object.fs.openSync (fs.js:427:18)
    at new module.exports.wtf.io.transports.FileWriteTransport (c:\Program Files\nodejs\node_modules\tracing-framework\build-out\wtf_node_js_compiled.js:12846:2
3)
    at Object.module.exports.wtf.trace.createTransport_ (c:\Program Files\nodejs\node_modules\tracing-framework\build-out\wtf_node_js_compiled.js:14154:83)
    at Object.module.exports.wtf.trace.snapshot (c:\Program Files\nodejs\node_modules\tracing-framework\build-out\wtf_node_js_compiled.js:14201:19)
    at process.<anonymous> (c:\Program Files\nodejs\node_modules\tracing-framework\build-out\wtf_node_js_compiled.js:17423:15)
    at process.EventEmitter.emit (events.js:95:17)

I found why this is happening, its because the trace file name is generated using the process.title which on windows contains the fullpath and sometimes the username running the process (depending on the shell used).

The replace regexp applied on the title doesn't replace \ or : so therefore the filename is always invalid on windows and won't save the trace file.

Is their a reason I don't understand for using the process.title over the file name passed in to node?

It would be nice if we can replace this code for something like this:

filename = require("path").basename(this.uri, '.js');
filename = filename.toLowerCase();
return filename 

That would still yield something myapp-20131202T192401.wtf-trace and will work for windows