Skip to content

Instantly share code, notes, and snippets.

@brcolow
Created October 2, 2017 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brcolow/018689c820762fdb31b0b0e5d2771909 to your computer and use it in GitHub Desktop.
Save brcolow/018689c820762fdb31b0b0e5d2771909 to your computer and use it in GitHub Desktop.
win_sudo.js
const download = spawnSync('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-NoLogo', '-NonInteractive', '-NoProfile',
'-Command', `"Invoke-WebRequest -Uri 'https://github.com/mattn/sudo/releases/download/v0.0.1/sudo-x86_64.zip' -OutFile '${paths.composer.binaryPath}\\sudo-x86_64.zip'"`], { stdio: 'inherit', encoding: 'utf8', shell: true });
const unzip = spawnSync('powershell.exe', ['-ExecutionPolicy', 'Bypass', '-NoLogo', '-NonInteractive', '-NoProfile',
'-Command', `"Add-Type -AssemblyName System.IO.Compression.FileSystem;[System.IO.Compression.ZipFile]::ExtractToDirectory('${paths.composer.binaryPath}\\sudo-x86_64.zip', '${paths.composer.binaryPath}\\sudo-x86_64');"`], { stdio: 'inherit', encoding: 'utf8', shell: true });
$.util.log($.util.colors.bgRed(`Download status: ${download.status} - unzip status: ${unzip.status}`));
$.util.log($.util.colors.bgRed(`Download error: ${download.signal} - unzip error: ${unzip.signal}`));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment