File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -185,21 +185,21 @@ PythonShell.prototype.receive = function (data) {
185185 this . _remaining = lastLine ;
186186
187187 lines . forEach ( function ( line ) {
188- if ( self . mode === 'json' ) {
188+ if ( self . parser ) {
189189 try {
190- self . emit ( 'message' , JSON . parse ( line ) ) ;
191- } catch ( err ) {
190+ self . emit ( 'message' , self . parser ( line ) ) ;
191+ } catch ( err ) {
192192 self . emit ( 'error' , extend (
193- new Error ( 'invalid JSON message: ' + data + ' >> ' + err ) ,
193+ new Error ( 'invalid message: ' + data + ' >> ' + err ) ,
194194 { inner : err , data : line }
195195 ) ) ;
196196 }
197- } else if ( typeof self . mode === 'function ' ) {
197+ } else if ( self . mode === 'json ' ) {
198198 try {
199- self . emit ( 'message' , self . mode ( line ) ) ;
200- } catch ( err ) {
199+ self . emit ( 'message' , JSON . parse ( line ) ) ;
200+ } catch ( err ) {
201201 self . emit ( 'error' , extend (
202- new Error ( 'invalid message: ' + data + ' >> ' + err ) ,
202+ new Error ( 'invalid JSON message: ' + data + ' >> ' + err ) ,
203203 { inner : err , data : line }
204204 ) ) ;
205205 }
You can’t perform that action at this time.
0 commit comments