@@ -32,7 +32,6 @@ class Npm {
3232 updateNotification = null
3333 argv = [ ]
3434
35- #commandName = null
3635 #command = null
3736 #runId = new Date ( ) . toISOString ( ) . replace ( / [ . : ] / g, '_' )
3837 #title = 'npm'
@@ -94,14 +93,7 @@ class Npm {
9493 }
9594
9695 async load ( ) {
97- return time . start ( 'npm:load' , async ( ) => {
98- const { exec, command, args } = await this . #load( )
99- return {
100- exec,
101- command,
102- args,
103- }
104- } )
96+ return time . start ( 'npm:load' , ( ) => this . #load( ) )
10597 }
10698
10799 get loaded ( ) {
@@ -225,21 +217,21 @@ class Npm {
225217 // We time this because setting process.title is slow sometimes but we
226218 // have to do it for security reasons. But still helpful to know how slow it is.
227219 time . start ( 'npm:load:setTitle' , ( ) => {
220+ const { parsedArgv : { cooked, remain } } = this . config
228221 // Secrets are mostly in configs, so title is set using only the positional args
229222 // to keep those from being leaked. We still do a best effort replaceInfo.
230- this . #title = [ 'npm' ] . concat ( replaceInfo ( this . config . parsedArgv . remain ) ) . join ( ' ' ) . trim ( )
223+ this . #title = [ 'npm' ] . concat ( replaceInfo ( remain ) ) . join ( ' ' ) . trim ( )
231224 process . title = this . #title
225+ // The cooked argv is also logged separately for debugging purposes. It is
226+ // cleaned as a best effort by replacing known secrets like basic auth
227+ // password and strings that look like npm tokens. XXX: for this to be
228+ // safer the config should create a sanitized version of the argv as it
229+ // has the full context of what each option contains.
230+ this . #argvClean = replaceInfo ( cooked )
231+ log . verbose ( 'title' , this . title )
232+ log . verbose ( 'argv' , this . #argvClean. map ( JSON . stringify ) . join ( ' ' ) )
232233 } )
233234
234- // The cooked argv is also logged separately for debugging purposes. It is
235- // cleaned as a best effort by replacing known secrets like basic auth
236- // password and strings that look like npm tokens. XXX: for this to be
237- // safer the config should create a sanitized version of the argv as it
238- // has the full context of what each option contains.
239- this . #argvClean = replaceInfo ( this . config . parsedArgv . cooked )
240- log . verbose ( 'title' , this . title )
241- log . verbose ( 'argv' , this . #argvClean. map ( JSON . stringify ) . join ( ' ' ) )
242-
243235 // logFile.load returns a promise that resolves when old logs are done being cleaned.
244236 // We save this promise to an array so that we can await it in tests to ensure more
245237 // deterministic logging behavior. The process will also hang open if this were to
0 commit comments