File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 9191 } ;
9292
9393 Spawnify . prototype . _emit = function emit ( event , data ) {
94- var count ;
94+ var self = this ,
95+ count = function ( event ) {
96+ var listeners = self . listeners ( event ) ;
97+
98+ return listeners . length ;
99+ } ;
95100
96101 assert ( event , 'event could not be empty!' ) ;
97102
98- count = this . listeners ( event ) . length ;
99-
100- if ( count || event === 'error' )
103+ if ( count ( event ) || event === 'error' ) {
101104 this . emit ( event , data ) ;
105+
106+ /*
107+ * when code is EACESS
108+ * close and exit events
109+ * whould not be emitted
110+ */
111+ if ( event === 'error' && data . code === 'EACCES' )
112+ if ( count ( 'close' ) )
113+ this . emit ( 'close' ) ;
114+
115+ if ( count ( 'exit' ) )
116+ this . emit ( 'exit' ) ;
117+ }
102118 } ;
103119
104120 Spawnify . prototype . _set = function set ( type , command , options ) {
You can’t perform that action at this time.
0 commit comments