"use strict";const performance=require("./vs/base/common/performance");performance.mark("code/fork/start");const bootstrap=require("./bootstrap"),bootstrapNode=require("./bootstrap-node");bootstrapNode.removeGlobalNodeModuleLookupPaths(),bootstrap.enableASARSupport(),process.env.VSCODE_INJECT_NODE_MODULE_LOOKUP_PATH&&bootstrapNode.injectNodeModuleLookupPath(process.env.VSCODE_INJECT_NODE_MODULE_LOOKUP_PATH),!!process.send&&process.env.VSCODE_PIPE_LOGGING==="true"&&pipeLoggingToParent(),process.env.VSCODE_HANDLES_UNCAUGHT_ERRORS||handleExceptions(),process.env.VSCODE_PARENT_PID&&terminateWhenParentTerminates(),process.env.VSCODE_WILL_SEND_MESSAGE_PORT&&listenForMessagePort(),require("./bootstrap-amd").load(process.env.VSCODE_AMD_ENTRYPOINT);function pipeLoggingToParent(){const n=1024*1024,f=1e5;function p(e){const s=[],c=[];if(e.length)for(let o=0;o<e.length;o++){let r=e[o];if(typeof r=="undefined")r="undefined";else if(r instanceof Error){const t=r;t.stack?r=t.stack:r=t.toString()}c.push(r)}if(process.env.VSCODE_LOG_STACK==="true"){const o=new Error().stack;o&&c.push({__$stack:o.split(`
`).slice(3).join(`
`)})}try{const o=JSON.stringify(c,function(r,t){if(d(t)||Array.isArray(t)){if(s.indexOf(t)!==-1)return"[Circular]";s.push(t)}return t});return o.length>f?"Output omitted for a large object that exceeds the limits":o}catch(o){return`Output omitted for an object that cannot be inspected ('${o.toString()}')`}}function O(e){try{process.send&&process.send(e)}catch{}}function d(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function u(e,s){O({type:"__$console",severity:e,arguments:s})}let a=!1;function i(e,s){if(process.env.VSCODE_LOG_NATIVE==="true"){const c=console[e],o=e==="error"||e==="warn"?process.stderr:process.stdout;Object.defineProperty(console,e,{set:()=>{},get:()=>function(){u(s,p(arguments)),a=!0,o.write(`
START_NATIVE_LOG
`),c.apply(console,arguments),o.write(`
END_NATIVE_LOG
`),a=!1}})}else Object.defineProperty(console,e,{set:()=>{},get:()=>function(){u(s,p(arguments))}})}function _(e,s){const c=process[e],o=c.write;let r="";Object.defineProperty(c,"write",{set:()=>{},get:()=>(t,E,g)=>{if(!a){r+=t.toString(E);const l=r.length>n?r.length:r.lastIndexOf(`
`);l!==-1&&(console[s](r.slice(0,l)),r=r.slice(l+1))}o.call(c,t,E,g)}})}process.env.VSCODE_VERBOSE_LOGGING==="true"?(i("info","log"),i("log","log"),i("warn","warn"),i("error","error")):process.env.VSCODE_LOG_NATIVE!=="true"&&(console.log=function(){},console.warn=function(){},console.info=function(){},i("error","error")),_("stderr","error"),_("stdout","log")}function handleExceptions(){process.on("uncaughtException",function(n){console.error("Uncaught Exception: ",n)}),process.on("unhandledRejection",function(n){console.error("Unhandled Promise Rejection: ",n)})}function terminateWhenParentTerminates(){const n=Number(process.env.VSCODE_PARENT_PID);typeof n=="number"&&!isNaN(n)&&setInterval(function(){try{process.kill(n,0)}catch{process.exit()}},5e3)}function listenForMessagePort(){process.on("port",n=>{global.vscodePortsCallback?global.vscodePortsCallback(n.ports):global.vscodePorts=n.ports})}

//# sourceMappingURL=bootstrap-fork.js.map
