File tree 2 files changed +15
-12
lines changed
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) {
275
275
return callback ( err ) ;
276
276
throw err ;
277
277
}
278
- if ( output !== "" ) {
278
+ try {
279
279
if ( argv . out )
280
280
fs . writeFileSync ( argv . out , output , { encoding : "utf8" } ) ;
281
281
else if ( ! callback )
282
282
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 ;
283
290
}
284
- return callback
285
- ? callback ( null , output )
286
- : undefined ;
287
291
} ) ;
288
292
}
289
293
Original file line number Diff line number Diff line change @@ -140,16 +140,15 @@ exports.main = function(args, callback) {
140
140
141
141
try {
142
142
if ( argv . out )
143
- fs . writeFileSync ( argv . out , output ) ;
144
- else
143
+ fs . writeFileSync ( argv . out , output , { encoding : "utf8" } ) ;
144
+ else if ( ! callback )
145
145
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 ;
148
149
} catch ( err ) {
149
- if ( callback ) {
150
- callback ( err ) ;
151
- return ;
152
- }
150
+ if ( callback )
151
+ return callback ( err ) ;
153
152
throw err ;
154
153
}
155
154
} ) ;
You can’t perform that action at this time.
0 commit comments