Template
1
0
mirror of https://github.com/aminya/setup-cpp synced 2024-11-30 21:22:30 +08:00
setup-cpp/dist/setup_cpp.js

3 lines
138 KiB
JavaScript
Raw Normal View History

2021-09-19 17:55:54 +08:00
function e(e){return e&&e.__esModule?e.default:e}function t(e,t,r,o){Object.defineProperty(e,t,{get:r,set:o,enumerable:!0,configurable:!0})}function r(e,t,o){if("function"==typeof t&&(o=t,t={}),!o){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise(((o,n)=>{r(e,t||{},((e,t)=>{e?n(e):o(t)}))}))}Ne(e,t||{},((e,r)=>{e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,r=!1),o(e,r)}))}function o(t,r,o){if(!["darwin","linux"].includes(process.platform))return;if("string"==typeof Me)return{binDir:Me};const n=e(Te).sync("brew",{nothrow:!0});return null!==n?(Me=ue.dirname(n),{binDir:Me}):(de.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),Me="/usr/local/bin/",{binDir:Me})}function n(e,t){const r=e.options.env||process.env,o=process.cwd(),n=null!=e.options.cwd,s=n&&void 0!==process.chdir&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch(e){}let i;try{i=Te.sync(e.command,{path:r[Ve({env:r})],pathExt:t?ue.delimiter:void 0})}catch(e){}finally{s&&process.chdir(o)}return i&&(i=ue.resolve(n?e.options.cwd:"",i)),i}function s(e,t){return Object.assign(Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function i(e,t){return Qe&&1===e&&!t.file?s(t.original,"spawn"):null}function a(e,t,r){const o=Be(e,t,r),n=de.spawn(o.command,o.args,o.options);return Ke.hookChildProcess(n,o),n}function c(){At&&(At=!1,$t.forEach((e=>{try{process.removeListener(e,Tt[e])}catch(e){}})),process.emit=Nt,process.reallyExit=It,_t.count-=1)}function l(e,t,r){_t.emitted[e]||(_t.emitted[e]=!0,_t.emit(e,t,r))}function u(){At||(At=!0,_t.count+=1,$t=$t.filter((e=>{try{return process.on(e,Tt[e]),!0}catch(e){return!1}})),process.emit=d,process.reallyExit=p)}function p(e){process.exitCode=e||0,l("exit",process.exitCode,null),l("afterexit",process.exitCode,null),It.call(process,process.exitCode)}function d(e,t){if("exit"===e){void 0!==t&&(process.exitCode=t);var r=Nt.apply(this,arguments);return l("exit",process.exitCode,null),l("afterexit",process.exitCode,null),r}return Nt.apply(this,arguments)}async function h(e,t){if(!e)throw Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,o=Vt(t);return await new Promise(((t,n)=>{const s=e=>{e&&o.getBufferedLength()<=Ht.MAX_LENGTH&&(e.bufferedData=o.getBufferedValue()),n(e)};(async()=>{try{await Wt(e,o),t()}catch(e){s(e)}})(),o.on("data",(()=>{o.getBufferedLength()>r&&s(new Yt)}))})),o.getBufferedValue()}function f(t,r){return void 0!==gr||(gr=(!!process.env.CI||0===(null===(o=process.getuid)||void 0===o?void 0:o.call(process)))&&null!==e(Te).sync("sudo",{nothrow:!0})),gr?e(Ge).command("sudo "+[t,...r].join(" "),{shell:!0}):e(Ge)(t,r);var o}async function m(e,t,r=!0){const o="apt-get";if("string"==typeof r&&await f("add-apt-repository",["--update","-y",r]),yr&&!0!==r||(await f(o,["update","-y"]),yr=!0),void 0!==t&&""!==t)try{await f(o,["install","-y",`${e}=${t}`])}catch{await f(o,["install","-y",`${e}-${t}`])}else await f(o,["install","-y",e]);return{binDir:"/usr/bin/"}}function v(t,r){return xr&&null!==e(Te).sync("brew",{nothrow:!0})||(o(0,0,process),xr=!0),e(Ge).sync("brew",["install",void 0!==r&&""!==r?`${t}@${r}`:t]),{binDir:"/usr/local/bin/"}}function g(t){try{Ce.addPath(t)}catch(r){try{switch(Ce.error(r),process.platform){case"win32":return void e(Ge).sync(`setx PATH=${t};%PATH%`);case"linux":case"darwin":return e(Ge).commandSync(`echo "export PATH=${t}:$PATH" >> ~/.profile`),e(Ge).commandSync("source ~/.profile"),void Ce.info(t+" was added to ~/.profile")}}catch(e){Ce.error(e)}Ce.error(`Failed to add ${t} to the percistent PATH. You should add it manually.`),process.env.PATH=`${t}${ue.delimiter}${process.env.PATH}`}}function y(t,r,o){if("win32"!==process.platform)return;if("string"==typeof wr)return{binDir:wr};const n=e(Te).sync("choco",{nothrow:!0});if(null!==n)return wr=ue.dirname(n),{binDir:wr};e(Ge).commandSync('@"%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -NoProfil
2021-09-18 04:00:26 +08:00
//# sourceMappingURL=setup_cpp.js.map