Created
June 8, 2021 17:23
-
-
Save tsukumijima/b7fbef4419bde4d6e536187ec4df6fd9 to your computer and use it in GitHub Desktop.
Windows で npm run serve を Ctrl+C で終了すると毎回「バッチ ジョブを終了しますか (Y/N)?」と表示されるのを回避するための PowerShell スクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env pwsh | |
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent | |
$exe="" | |
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { | |
# Fix case when both the Windows and Linux builds of Node | |
# are installed in the same directory | |
$exe=".exe" | |
} | |
$ret=0 | |
if (Test-Path "$basedir/node$exe") { | |
& "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args | |
$ret=$LASTEXITCODE | |
} else { | |
& "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args | |
$ret=$LASTEXITCODE | |
} | |
exit $ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env pwsh | |
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent | |
$exe="" | |
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { | |
# Fix case when both the Windows and Linux builds of Node | |
# are installed in the same directory | |
$exe=".exe" | |
} | |
$ret=0 | |
if (Test-Path "$basedir/node$exe") { | |
& "$basedir/node$exe" "$basedir/node_modules/npm/bin/npx-cli.js" $args | |
$ret=$LASTEXITCODE | |
} else { | |
& "node$exe" "$basedir/node_modules/npm/bin/npx-cli.js" $args | |
$ret=$LASTEXITCODE | |
} | |
exit $ret |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment