-
Notifications
You must be signed in to change notification settings - Fork 64
console.log logs to terminal but not console window #115
Comments
The code I'm testing is: console.log("JS engine: " + process.jsEngine); Note that this happens even if I take steps to ensure that the console window is open first, f.e. by adding a mainWindow.webContents.on('devtools-opened', function() {
console.log("JS engine: " + process.jsEngine);
}); (Although I wouldn't expect the message to appear in the main window's console, since that console is presumably only for messages logged by the page in that window.) |
I think you might find this stackoverflow question should solve your issue : |
@red15 That question concerns a console for a BrowserWindow, whereas this issue occurs in the console for the main process, i.e. the console in the Developer Tools window that opens when you append Note that the "main process console" is Positron-specific, as Electron doesn't provide a Developer Tools window for the main process (although you can connect to that process via an external debugger). |
@mykmelez: Where do thrown errors get logged to? That is, is STDERR the same channel as STDOUT? Maybe Electron/Positron do something different. From what I've read, Electron is built around Node process (vs. NW.js around the HTML). |
Erm, I'm not quite sure what you're asking here, but the disposition of stderr and stdout is presumably the responsibility of the environment. Positron does whatever Gecko does with errors thrown in JavaScript, which is presumably to write them to stderr in addition to any relevant Developer Tools console.
Yes, Electron and Positron are likely to do different things. And indeed, Electron's initial process runs a script in a Node context that doesn't have access to an HTML DOM, while NW.js's initial process loads a web page in a context that does have access to an HTML DOM.
I appreciate the research (yours, and @red15's as well)! However, this issue is highly likely to be specific to Positron (and the Gecko Developer Tools implementation more generally), not something that also exists in Electron, nor something that can be addressed by Node.js debugging documentation. There's something about the way that we've integrated Node into the Gecko "chrome" process that causes these errors to not make it to the Developer Tools console for that process (which one can open via the Positron-specific |
On the node-integration branch, when I call console.log in the main.js script of the "hello world" app, the log message appears in the terminal window from which I ran Positron, but it doesn't appear in the devtools console window.
The text was updated successfully, but these errors were encountered: