File tree 2 files changed +7
-5
lines changed
2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -216,11 +216,13 @@ class Npm {
216
216
fs . mkdir ( this . cache , { recursive : true } )
217
217
. catch ( ( e ) => log . verbose ( 'cache' , `could not create cache: ${ e } ` ) ) )
218
218
219
- // its ok if this fails. user might have specified an invalid dir
219
+ // it's ok if this fails. user might have specified an invalid dir
220
220
// which we will tell them about at the end
221
- await this . time ( 'npm:load:mkdirplogs' , ( ) =>
222
- fs . mkdir ( this . logsDir , { recursive : true } )
223
- . catch ( ( e ) => log . verbose ( 'logfile' , `could not create logs-dir: ${ e } ` ) ) )
221
+ if ( this . config . get ( 'logs-max' ) > 0 ) {
222
+ await this . time ( 'npm:load:mkdirplogs' , ( ) =>
223
+ fs . mkdir ( this . logsDir , { recursive : true } )
224
+ . catch ( ( e ) => log . verbose ( 'logfile' , `could not create logs-dir: ${ e } ` ) ) )
225
+ }
224
226
225
227
// note: this MUST be shorter than the actual argv length, because it
226
228
// uses the same memory, so node will truncate it if it's too long.
Original file line number Diff line number Diff line change @@ -344,12 +344,12 @@ t.test('no logs dir', async (t) => {
344
344
const { exitHandler, logs } = await mockExitHandler ( t , {
345
345
config : { 'logs-max' : 0 } ,
346
346
} )
347
-
348
347
await exitHandler ( new Error ( ) )
349
348
350
349
t . match ( logs . error . filter ( ( [ t ] ) => t === '' ) , [
351
350
[ '' , 'Log files were not written due to the config logs-max=0' ] ,
352
351
] )
352
+ t . match ( logs . filter ( ( [ _ , task ] ) => task === 'npm.load.mkdirplogs' ) , [ ] )
353
353
} )
354
354
355
355
t . test ( 'timers fail to write' , async ( t ) => {
You can’t perform that action at this time.
0 commit comments