A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/npm/cli/commit/e758dd7bec58efed2cc865a6d360b0432ccc9f57 below:

multiple Invoke-Expression fixes (#8318) · npm/cli@e758dd7 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+24

-38

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+24

-38

lines changed Original file line number Diff line number Diff line change

@@ -22,34 +22,27 @@ if (Test-Path $NPM_PREFIX_NPM_CLI_JS) {

22 22

$NPM_CLI_JS=$NPM_PREFIX_NPM_CLI_JS

23 23

}

24 24 25 -

if ($MyInvocation.Line) { # used "-Command" argument

25 +

if ($MyInvocation.ExpectingInput) { # takes pipeline input

26 +

$input | & $NODE_EXE $NPM_CLI_JS $args

27 +

} elseif (-not $MyInvocation.Line) { # used "-File" argument

28 +

& $NODE_EXE $NPM_CLI_JS $args

29 +

} else { # used "-Command" argument

26 30

if ($MyInvocation.Statement) {

27 -

$NPM_ARGS = $MyInvocation.Statement.Substring($MyInvocation.InvocationName.Length).Trim()

31 +

$NPM_ORIGINAL_COMMAND = $MyInvocation.Statement

28 32

} else {

29 -

$NPM_OG_COMMAND = (

30 -

[System.Management.Automation.InvocationInfo].GetProperty('ScriptPosition', [System.Reflection.BindingFlags] 'Instance, NonPublic')

33 +

$NPM_ORIGINAL_COMMAND = (

34 +

[Management.Automation.InvocationInfo].GetProperty('ScriptPosition', [Reflection.BindingFlags] 'Instance, NonPublic')

31 35

).GetValue($MyInvocation).Text

32 -

$NPM_ARGS = $NPM_OG_COMMAND.Substring($MyInvocation.InvocationName.Length).Trim()

33 36

}

34 37 35 38

$NODE_EXE = $NODE_EXE.Replace("``", "````")

36 39

$NPM_CLI_JS = $NPM_CLI_JS.Replace("``", "````")

37 40 38 -

# Support pipeline input

39 -

if ($MyInvocation.ExpectingInput) {

40 -

$input = (@($input) -join "`n").Replace("``", "````")

41 +

$NPM_NO_REDIRECTS_COMMAND = [Management.Automation.Language.Parser]::ParseInput($NPM_ORIGINAL_COMMAND, [ref] $null, [ref] $null).

42 +

EndBlock.Statements.PipelineElements.CommandElements.Extent.Text -join ' '

43 +

$NPM_ARGS = $NPM_NO_REDIRECTS_COMMAND.Substring($MyInvocation.InvocationName.Length).Trim()

41 44 42 -

Invoke-Expression "Write-Output `"$input`" | & `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS"

43 -

} else {

44 -

Invoke-Expression "& `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS"

45 -

}

46 -

} else { # used "-File" argument

47 -

# Support pipeline input

48 -

if ($MyInvocation.ExpectingInput) {

49 -

$input | & $NODE_EXE $NPM_CLI_JS $args

50 -

} else {

51 -

& $NODE_EXE $NPM_CLI_JS $args

52 -

}

45 +

Invoke-Expression "& `"$NODE_EXE`" `"$NPM_CLI_JS`" $NPM_ARGS"

53 46

}

54 47 55 48

exit $LASTEXITCODE

Original file line number Diff line number Diff line change

@@ -22,34 +22,27 @@ if (Test-Path $NPM_PREFIX_NPX_CLI_JS) {

22 22

$NPX_CLI_JS=$NPM_PREFIX_NPX_CLI_JS

23 23

}

24 24 25 -

if ($MyInvocation.Line) { # used "-Command" argument

25 +

if ($MyInvocation.ExpectingInput) { # takes pipeline input

26 +

$input | & $NODE_EXE $NPX_CLI_JS $args

27 +

} elseif (-not $MyInvocation.Line) { # used "-File" argument

28 +

& $NODE_EXE $NPX_CLI_JS $args

29 +

} else { # used "-Command" argument

26 30

if ($MyInvocation.Statement) {

27 -

$NPX_ARGS = $MyInvocation.Statement.Substring($MyInvocation.InvocationName.Length).Trim()

31 +

$NPX_ORIGINAL_COMMAND = $MyInvocation.Statement

28 32

} else {

29 -

$NPX_OG_COMMAND = (

30 -

[System.Management.Automation.InvocationInfo].GetProperty('ScriptPosition', [System.Reflection.BindingFlags] 'Instance, NonPublic')

33 +

$NPX_ORIGINAL_COMMAND = (

34 +

[Management.Automation.InvocationInfo].GetProperty('ScriptPosition', [Reflection.BindingFlags] 'Instance, NonPublic')

31 35

).GetValue($MyInvocation).Text

32 -

$NPX_ARGS = $NPX_OG_COMMAND.Substring($MyInvocation.InvocationName.Length).Trim()

33 36

}

34 37 35 38

$NODE_EXE = $NODE_EXE.Replace("``", "````")

36 39

$NPX_CLI_JS = $NPX_CLI_JS.Replace("``", "````")

37 40 38 -

# Support pipeline input

39 -

if ($MyInvocation.ExpectingInput) {

40 -

$input = (@($input) -join "`n").Replace("``", "````")

41 +

$NPX_NO_REDIRECTS_COMMAND = [Management.Automation.Language.Parser]::ParseInput($NPX_ORIGINAL_COMMAND, [ref] $null, [ref] $null).

42 +

EndBlock.Statements.PipelineElements.CommandElements.Extent.Text -join ' '

43 +

$NPX_ARGS = $NPX_NO_REDIRECTS_COMMAND.Substring($MyInvocation.InvocationName.Length).Trim()

41 44 42 -

Invoke-Expression "Write-Output `"$input`" | & `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS"

43 -

} else {

44 -

Invoke-Expression "& `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS"

45 -

}

46 -

} else { # used "-File" argument

47 -

# Support pipeline input

48 -

if ($MyInvocation.ExpectingInput) {

49 -

$input | & $NODE_EXE $NPX_CLI_JS $args

50 -

} else {

51 -

& $NODE_EXE $NPX_CLI_JS $args

52 -

}

45 +

Invoke-Expression "& `"$NODE_EXE`" `"$NPX_CLI_JS`" $NPX_ARGS"

53 46

}

54 47 55 48

exit $LASTEXITCODE

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4