@@ -24,10 +24,10 @@ let mainWindow = null;
2424let pluginName ;
2525let spawnOptions ;
2626let webrecorderProcess ;
27- let stdoutDebug = [ ] ;
27+ let debugOutput = [ ] ;
2828
2929const projectDir = path . join ( __dirname , '../' ) ;
30- const stdio = [ 'ignore' , 'pipe' , 'ignore ' ] ;
30+ const stdio = [ 'ignore' , 'pipe' , 'pipe ' ] ;
3131const wrConfig = { } ;
3232const pluginDir = 'plugins' ;
3333
@@ -71,7 +71,7 @@ const registerOpenWarc = function () {
7171
7272 ipcMain . on ( 'open-warc' , ( event , argument ) => {
7373 const warc = argument ;
74- stdoutDebug = [ ] ;
74+ debugOutput = [ ] ;
7575 console . log ( `warc file: ${ warc } ` ) ;
7676
7777 // notify renderer that we are initializing webrecorder binary
@@ -96,17 +96,29 @@ const registerOpenWarc = function () {
9696
9797 // catch any errors spawning webrecorder binary and add to debug info
9898 webrecorderProcess . on ( 'error' , ( err ) => {
99- stdoutDebug . push ( `Error spawning ${ webrecorder } binary:\n ${ err } \n\n` ) ;
99+ debugOutput . push ( `Error spawning ${ webrecorder } binary:\n ${ err } \n\n` ) ;
100+ } ) ;
101+
102+ // log any stderr notices
103+ webrecorderProcess . stderr . on ( 'data' , ( buff ) => {
104+ debugOutput . push ( `stderr: ${ buff . toString ( ) } ` ) ;
105+
106+ // clip line buffer
107+ if ( debugOutput . length > 500 ) {
108+ debugOutput . shift ( ) ;
109+ }
100110 } ) ;
101111
102112 let port ;
103113
104114 const findPort = function ( rawBuff ) {
105115 const buff = rawBuff . toString ( ) ;
106116
107- stdoutDebug . push ( buff ) ;
108- if ( stdoutDebug . length > 500 ) {
109- stdoutDebug . shift ( ) ;
117+ debugOutput . push ( buff ) ;
118+
119+ // clip line buffer
120+ if ( debugOutput . length > 500 ) {
121+ debugOutput . shift ( ) ;
110122 }
111123
112124 if ( ! buff || port ) {
@@ -239,5 +251,5 @@ app.on('ready', async () => {
239251ipcMain . on ( 'async-call' , ( evt , arg ) => {
240252 evt . sender . send ( 'async-response' , {
241253 config : wrConfig ,
242- stdout : stdoutDebug . join ( '<BR>' ) . replace ( / \n / g, '<BR>' ) } ) ;
254+ stdout : debugOutput . join ( '<BR>' ) . replace ( / \n / g, '<BR>' ) } ) ;
243255} ) ;
0 commit comments