File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
import process from 'node:process'
2
2
3
+ import { isDebug } from '@socketsecurity/registry/lib/debug'
3
4
import {
4
5
isLoglevelFlag ,
5
6
isProgressFlag
@@ -21,11 +22,14 @@ export default async function shadowBin(
21
22
level = 1
22
23
) {
23
24
process . exitCode = 1
25
+ const useDebug = isDebug ( )
24
26
const terminatorPos = args . indexOf ( '--' )
25
27
const binArgs = (
26
28
terminatorPos === - 1 ? args : args . slice ( 0 , terminatorPos )
27
29
) . filter ( a => ! isProgressFlag ( a ) )
28
30
const otherArgs = terminatorPos === - 1 ? [ ] : args . slice ( terminatorPos )
31
+ const isSilent = ! useDebug && ! binArgs . some ( isLoglevelFlag )
32
+ const logLevelArgs = isSilent ? [ '--loglevel' , 'silent' ] : [ ]
29
33
const spawnPromise = spawn (
30
34
// Lazily access constants.execPath.
31
35
constants . execPath ,
@@ -49,8 +53,9 @@ export default async function shadowBin(
49
53
await installLinks ( constants . shadowBinPath , binName ) ,
50
54
// Add `--no-progress` to fix input being swallowed by the npm spinner.
51
55
'--no-progress' ,
52
- // Add the '--loglevel=silent' flag if a loglevel flag is not provided.
53
- ...( binArgs . some ( isLoglevelFlag ) ? [ ] : [ '--loglevel' , 'silent' ] ) ,
56
+ // Add '--loglevel=silent' if a loglevel flag is not provided and the
57
+ // SOCKET_CLI_DEBUG environment variable is not truthy.
58
+ ...logLevelArgs ,
54
59
...binArgs ,
55
60
...otherArgs
56
61
] ,
Original file line number Diff line number Diff line change @@ -37,11 +37,11 @@ export function safeNpmInstall(options?: SafeNpmInstallOptions) {
37
37
const useIpc = isObject ( ipc )
38
38
const useDebug = isDebug ( )
39
39
const terminatorPos = args . indexOf ( '--' )
40
- const npmArgs = (
40
+ const binArgs = (
41
41
terminatorPos === - 1 ? args : args . slice ( 0 , terminatorPos )
42
42
) . filter ( a => ! isAuditFlag ( a ) && ! isFundFlag ( a ) && ! isProgressFlag ( a ) )
43
43
const otherArgs = terminatorPos === - 1 ? [ ] : args . slice ( terminatorPos )
44
- const isSilent = ! useDebug && ! npmArgs . some ( isLoglevelFlag )
44
+ const isSilent = ! useDebug && ! binArgs . some ( isLoglevelFlag )
45
45
const logLevelArgs = isSilent ? [ '--loglevel' , 'silent' ] : [ ]
46
46
const spawnPromise = spawn (
47
47
// Lazily access constants.execPath.
@@ -72,7 +72,7 @@ export function safeNpmInstall(options?: SafeNpmInstallOptions) {
72
72
// Add '--loglevel=silent' if a loglevel flag is not provided and the
73
73
// SOCKET_CLI_DEBUG environment variable is not truthy.
74
74
...logLevelArgs ,
75
- ...npmArgs ,
75
+ ...binArgs ,
76
76
...otherArgs
77
77
] ,
78
78
{
You can’t perform that action at this time.
0 commit comments