setup-cpp/dist/setup_cpp.js

3 lines
149 KiB
JavaScript
Raw Normal View History

2021-11-22 06:22:27 +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,r){const o=new Fe(e,t,r);process.stdout.write(""+o+ke.EOL)}function o(e,t){const r=process.env["INPUT_"+e.replace(/ /g,"_").toUpperCase()]||"";if(t&&t.required&&!r)throw Error("Input required and not supplied: "+e);return t&&!1===t.trimWhitespace?r:r.trim()}function n(e,t={}){Ne.issueCommand("error",Me.toCommandProperties(t),e instanceof Error?""+e:e)}function s(e){Ne.issue("group",e)}function i(){Ne.issue("endgroup")}function a(e,t,r){if("function"==typeof t&&(r=t,t={}),!r){if("function"!=typeof Promise)throw new TypeError("callback not provided");return new Promise(((r,o)=>{a(e,t||{},((e,t)=>{e?o(e):r(t)}))}))}nt(e,t||{},((e,o)=>{e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,o=!1),r(e,o)}))}function c(t,r,o){if(!["darwin","linux"].includes(process.platform))return;if("string"==typeof lt)return{binDir:lt};const n=e(tt).sync("brew",{nothrow:!0});return null!==n?(lt=ce.dirname(n),{binDir:lt}):(ge.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),lt="/usr/local/bin/",{binDir:lt})}function l(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=tt.sync(e.command,{path:r[ft({env:r})],pathExt:t?ce.delimiter:void 0})}catch(e){}finally{s&&process.chdir(o)}return i&&(i=ce.resolve(n?e.options.cwd:"",i)),i}function u(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 p(e,t){return Pt&&1===e&&!t.file?u(t.original,"spawn"):null}function d(e,t,r){const o=ht(e,t,r),n=ge.spawn(o.command,o.args,o.options);return St.hookChildProcess(n,o),n}function h(){rr&&(rr=!1,Jt.forEach((e=>{try{process.removeListener(e,tr[e])}catch(e){}})),process.emit=nr,process.reallyExit=or,Zt.count-=1)}function f(e,t,r){Zt.emitted[e]||(Zt.emitted[e]=!0,Zt.emit(e,t,r))}function m(){rr||(rr=!0,Zt.count+=1,Jt=Jt.filter((e=>{try{return process.on(e,tr[e]),!0}catch(e){return!1}})),process.emit=g,process.reallyExit=v)}function v(e){process.exitCode=e||0,f("exit",process.exitCode,null),f("afterexit",process.exitCode,null),or.call(process,process.exitCode)}function g(e,t){if("exit"===e){void 0!==t&&(process.exitCode=t);var r=nr.apply(this,arguments);return f("exit",process.exitCode,null),f("afterexit",process.exitCode,null),r}return nr.apply(this,arguments)}async function y(e,t){if(!e)throw Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,o=fr(t);return await new Promise(((t,n)=>{const s=e=>{e&&o.getBufferedLength()<=vr.MAX_LENGTH&&(e.bufferedData=o.getBufferedValue()),n(e)};(async()=>{try{await yr(e,o),t()}catch(e){s(e)}})(),o.on("data",(()=>{o.getBufferedLength()>r&&s(new xr)}))})),o.getBufferedValue()}function x(t,r){return void 0!==Ur||(Ur=(!!process.env.CI||0===(null===(o=process.getuid)||void 0===o?void 0:o.call(process)))&&null!==e(tt).sync("sudo",{nothrow:!0})),Ur?e(pt).command("sudo "+[t,...r].join(" "),{shell:!0}):e(pt)(t,r);var o}async function w(e,t,r=!0){const o="apt-get";if("string"==typeof r&&await x("add-apt-repository",["--update","-y",r]),Br&&!0!==r||(await x(o,["update","-y"]),Br=!0),void 0!==t&&""!==t)try{await x(o,["install","-y",`${e}=${t}`])}catch{await x(o,["install","-y",`${e}-${t}`])}else await x(o,["install","-y",e]);return{binDir:"/usr/bin/"}}function E(t,r){return qr&&null!==e(tt).sync("brew",{nothrow:!0})||(c(0,0,process),qr=!0),e(pt).sync("brew",["install",void 0!==r&&""!==r?`${t}@${r}`:t]),{binDir:"/usr/local/bin/"}}function b(t){try{Te.addPath(t)}catch(r){try{switch(Te.error(r),process.platform){case"win32":return void e(pt).sync(`setx PATH=${t};%PATH%`);case"linux":case"darwin":return e(pt).commandSync(`echo "export PATH=${t}:$PATH" >> ~/.profile`),e(pt).commandSync("source ~/.profile"),void Te.info(t+" was added to ~/.profile")}}catch(
2021-09-18 04:00:26 +08:00
//# sourceMappingURL=setup_cpp.js.map