setup-cpp/dist/setup_cpp.js

3 lines
151 KiB
JavaScript
Raw Permalink Normal View History

2021-12-12 07:21:44 +08:00
function e(e){return e&&e.__esModule?e.default:e}function t(e,t,r,n){Object.defineProperty(e,t,{get:r,set:n,enumerable:!0,configurable:!0})}function r(e,t,r){const n=new Ke(e,t,r);process.stdout.write(""+n+Ye.EOL)}function n(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 o(e,t={}){Be.issueCommand("error",ze.toCommandProperties(t),e instanceof Error?""+e:e)}function s(e){Be.issue("group",e)}function i(){Be.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,n)=>{a(e,t||{},((e,t)=>{e?n(e):r(t)}))}))}mt(e,t||{},((e,n)=>{e&&("EACCES"===e.code||t&&t.ignoreErrors)&&(e=null,n=!1),r(e,n)}))}function c(t,r,n){if(!["darwin","linux"].includes(process.platform))return;if("string"==typeof wt)return{binDir:wt};const o=e(dt).sync("brew",{nothrow:!0});return null!==o?(wt=xe.dirname(o),{binDir:wt}):(Te.execFileSync('/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"',{stdio:"inherit"}),wt="/usr/local/bin/",{binDir:wt})}function l(e,t){const r=e.options.env||process.env,n=process.cwd(),o=null!=e.options.cwd,s=o&&void 0!==process.chdir&&!process.chdir.disabled;if(s)try{process.chdir(e.options.cwd)}catch(e){}let i;try{i=dt.sync(e.command,{path:r[Ot({env:r})],pathExt:t?xe.delimiter:void 0})}catch(e){}finally{s&&process.chdir(n)}return i&&(i=xe.resolve(o?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 Dt&&1===e&&!t.file?u(t.original,"spawn"):null}function d(e,t,r){const n=Pt(e,t,r),o=Te.spawn(n.command,n.args,n.options);return Lt.hookChildProcess(o,n),o}function h(){hr&&(hr=!1,lr.forEach((e=>{try{process.removeListener(e,dr[e])}catch(e){}})),process.emit=mr,process.reallyExit=fr,cr.count-=1)}function f(e,t,r){cr.emitted[e]||(cr.emitted[e]=!0,cr.emit(e,t,r))}function m(){hr||(hr=!0,cr.count+=1,lr=lr.filter((e=>{try{return process.on(e,dr[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),fr.call(process,process.exitCode)}function g(e,t){if("exit"===e){void 0!==t&&(process.exitCode=t);var r=mr.apply(this,arguments);return f("exit",process.exitCode,null),f("afterexit",process.exitCode,null),r}return mr.apply(this,arguments)}async function y(e,t){if(!e)throw Error("Expected a stream");t={maxBuffer:1/0,...t};const{maxBuffer:r}=t,n=Or(t);return await new Promise(((t,o)=>{const s=e=>{e&&n.getBufferedLength()<=Cr.MAX_LENGTH&&(e.bufferedData=n.getBufferedValue()),o(e)};(async()=>{try{await $r(e,n),t()}catch(e){s(e)}})(),n.on("data",(()=>{n.getBufferedLength()>r&&s(new Ir)}))})),n.getBufferedValue()}function x(t,r,n){return void 0!==Qr||(Qr=(!!process.env.CI||0===(null===(o=process.getuid)||void 0===o?void 0:o.call(process)))&&null!==e(dt).sync("sudo",{nothrow:!0})),Qr?e(Et).command("sudo "+[t,...r].map((e=>`'${e}'`)).join(" "),{shell:!0,cwd:n}):e(Et)(t,r);var o}async function w(e,t,r=!0){const n="apt-get";if(Array.isArray(r))for(const e of r)await x("add-apt-repository",["--update","-y",e]);if(tn&&!0!==r||(await x(n,["update","-y"]),tn=!0),void 0!==t&&""!==t)try{await x(n,["install","--fix-broken","-y",`${e}=${t}`])}catch{await x(n,["install","--fix-broken","-y",`${e}-${t}`])}else await x(n,["install","--fix-broken","-y",e]);return{binDir:"/usr/bin/"}}function b(t,r){return rn&&null!==e(dt).sync("brew",{nothrow:!0})||(c(0,0,process),rn=!0),e(Et).sync("brew",["install",void 0!==r&&""!==r?`${t}@${r}`:t]),{binDir:"/usr/local/bin/"}}function E(t){try{Me.addPath(t)}catch(r){try{switch(Me.error(r),process.platform){case"win32":return void e(Et).sync(`setx PATH=${t};%PATH%`);case"linux":case"darwin":return e(Et).commandSync(`echo "export PATH=${t}:$PATH" >> ~/.profile`),
2021-09-18 04:00:26 +08:00
//# sourceMappingURL=setup_cpp.js.map