-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Console.log fails in Windows TextEditors #1961
Comments
@igorzi, @piscisaureus: Can you review this bug report? I think @ry is fixing this by making stdio synchronous / flushing on exit. |
I don't think this is related. @robinmattern do you know what "run" command in textpad does exactly? Do it redirect stdout/stderr to a pipe? to a file? etc. I'll try to reproduce this. |
I can't reproduce this. I ran "node.exe foo.js" using testpad's run command, and it ran fine (with output captured): console.error("bar"); |
Igor, Hmmm.... I am running an older version, v4.7.3, of TextPad (not TestPad), [image: image.png] [image: image.png]
|
I guess the images aren't allowed. You can see them at this location, http://www.jscriptware.us/node/console.log-error/ Also, I mispelled the second editor's name, it is Komodo (http://www.activestate.com/komodo-edit). And no, I don't know what they are doing, other than that they are capturing the DOS output (stdout?) into the editor itself. |
Same thing happens in WebStorm, FWIW. |
@robinmattern/@GraemeF, does this reproduce with v0.6.0? |
related to #2065 ? |
I tested v0.6.0 in TextPad on Windows 7 and 2008 and it works like a charm: Here is a more elaborate test:
and the captured output:
It also works in ActiveState's Komodo, with some color for console.warn, trace and error. |
@robinmattern Ok, thanks. |
I am new to node.js, so this may not be a legitimate issue, but I noticed that you are removing process.writeError (see #1860).
This will break the only way that I could display console messages when I test node,js code using the "run" command inside Windows text editors such as TextPad or Komondo. Console.log() fails in this environment, but console.error() does not in version 0.5.9.
I looked at the source for console.error() in version 0.5.9, and I see it uses writeError(), but in version 0.5.10 it uses process.stderr.write(). When I tested this function directly, along with process.stdout.write(), it too fails when run as a batch command from within the two editors I tested.
Here is a listing of a script, test.js, that I wrote and the output that I get when I run it within the text editors. I also ran it in DOS, which works fine, other than the direct call to writeError(), which may be a local, private function.
Here is a test script, E:\test.js, that reproduces the error
process.stdout.write( " process.stdout.write( aStr ) // fails in editor, works in DOS\n" )
process.stderr.write( " process.stderr.write( aStr ) // fails in editor, works in DOS\n" )
writeError( " writeError( aStr ) // fails in editor, fails in DOS\n" )
In Editor: node.exe E:\test.js // fails on console.log()
console.error( aStr ) // works in editor, works in DOS
node.js:203
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Cannot call method 'write' of null
at Socket.write (net_uv.js:389:31)
at Object. (E:\test.js:5:19)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array. (module.js:470:10)
at EventEmitter._tickCallback (node.js:195:26)
I've seen this error, too:
node.js:203
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: write EINVAL
at errnoException (net_uv.js:569:11)
at Socket.write (net_uv.js:392:18)
at Object. (E:\test.js:5:19)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array. (module.js:470:10)
at EventEmitter._tickCallback (node.js:195:26)
In DOS: node E:\test.js // fails on writeError()
console.error( aStr ) // works in editor, works in DOS
console.log( aStr ) // fails in editor, works in DOS
process.stdout.write( aStr ) // fails in editor, works in DOS
process.stderr.write( aStr ) // fails in editor, works in DOS
node.js:203
throw e; // process.nextTick error, or 'error' event on first tick
^
ReferenceError: writeError is not defined
at Object. (E:\test.js:5:19)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Array. (module.js:470:10)
at EventEmitter._tickCallback (node.js:195:26)
The text was updated successfully, but these errors were encountered: