File tree Expand file tree Collapse file tree 2 files changed +15
-12
lines changed
Expand file tree Collapse file tree 2 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -275,15 +275,19 @@ exports.main = function main(args, callback) {
275275 return callback ( err ) ;
276276 throw err ;
277277 }
278- if ( output !== "" ) {
278+ try {
279279 if ( argv . out )
280280 fs . writeFileSync ( argv . out , output , { encoding : "utf8" } ) ;
281281 else if ( ! callback )
282282 process . stdout . write ( output , "utf8" ) ;
283+ return callback
284+ ? callback ( null , output )
285+ : undefined ;
286+ } catch ( err ) {
287+ if ( callback )
288+ return callback ( err ) ;
289+ throw err ;
283290 }
284- return callback
285- ? callback ( null , output )
286- : undefined ;
287291 } ) ;
288292 }
289293
Original file line number Diff line number Diff line change @@ -140,16 +140,15 @@ exports.main = function(args, callback) {
140140
141141 try {
142142 if ( argv . out )
143- fs . writeFileSync ( argv . out , output ) ;
144- else
143+ fs . writeFileSync ( argv . out , output , { encoding : "utf8" } ) ;
144+ else if ( ! callback )
145145 process . stdout . write ( output , "utf8" ) ;
146- if ( callback )
147- callback ( null ) ; // eslint-disable-line callback-return
146+ return callback
147+ ? callback ( null , output )
148+ : undefined ;
148149 } catch ( err ) {
149- if ( callback ) {
150- callback ( err ) ;
151- return ;
152- }
150+ if ( callback )
151+ return callback ( err ) ;
153152 throw err ;
154153 }
155154 } ) ;
You can’t perform that action at this time.
0 commit comments