extract-zip.ps1 797 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env pwsh
  2. $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
  3. $exe=""
  4. if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
  5. # Fix case when both the Windows and Linux builds of Node
  6. # are installed in the same directory
  7. $exe=".exe"
  8. }
  9. $ret=0
  10. if (Test-Path "$basedir/node$exe") {
  11. # Support pipeline input
  12. if ($MyInvocation.ExpectingInput) {
  13. $input | & "$basedir/node$exe" "$basedir/../extract-zip/cli.js" $args
  14. } else {
  15. & "$basedir/node$exe" "$basedir/../extract-zip/cli.js" $args
  16. }
  17. $ret=$LASTEXITCODE
  18. } else {
  19. # Support pipeline input
  20. if ($MyInvocation.ExpectingInput) {
  21. $input | & "node$exe" "$basedir/../extract-zip/cli.js" $args
  22. } else {
  23. & "node$exe" "$basedir/../extract-zip/cli.js" $args
  24. }
  25. $ret=$LASTEXITCODE
  26. }
  27. exit $ret