UNPKG

@coder/code-server-pr

Version:

Run VS Code on a remote server.

11 lines (9 loc) 3.23 kB
"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(),configureCrashReporter(),require("./bootstrap-amd").load(process.env.VSCODE_AMD_ENTRYPOINT);function pipeLoggingToParent(){const n=1024*1024,i=1e5;function l(e){const s=[],c=[];if(e.length)for(let r=0;r<e.length;r++){let o=e[r];if(typeof o=="undefined")o="undefined";else if(o instanceof Error){const t=o;t.stack?o=t.stack:o=t.toString()}c.push(o)}if(process.env.VSCODE_LOG_STACK==="true"){const r=new Error().stack;r&&c.push({__$stack:r.split(` `).slice(3).join(` `)})}try{const r=JSON.stringify(c,function(o,t){if(d(t)||Array.isArray(t)){if(s.indexOf(t)!==-1)return"[Circular]";s.push(t)}return t});return r.length>i?"Output omitted for a large object that exceeds the limits":r}catch(r){return`Output omitted for an object that cannot be inspected ('${r.toString()}')`}}function E(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){E({type:"__$console",severity:e,arguments:s})}let f=!1;function a(e,s){if(process.env.VSCODE_LOG_NATIVE==="true"){const c=console[e],r=e==="error"||e==="warn"?process.stderr:process.stdout;Object.defineProperty(console,e,{set:()=>{},get:()=>function(){u(s,l(arguments)),f=!0,r.write(` START_NATIVE_LOG `),c.apply(console,arguments),r.write(` END_NATIVE_LOG `),f=!1}})}else Object.defineProperty(console,e,{set:()=>{},get:()=>function(){u(s,l(arguments))}})}function O(e,s){const c=process[e],r=c.write;let o="";Object.defineProperty(c,"write",{value:(t,_,g)=>{if(!f){o+=t.toString(_);const p=o.length>n?o.length:o.lastIndexOf(` `);p!==-1&&(console[s](o.slice(0,p)),o=o.slice(p+1))}r.call(c,t,_,g)}})}process.env.VSCODE_VERBOSE_LOGGING==="true"?(a("info","log"),a("log","log"),a("warn","warn"),a("error","error")):process.env.VSCODE_LOG_NATIVE!=="true"&&(console.log=function(){},console.warn=function(){},console.info=function(){},a("error","error")),O("stderr","error"),O("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 configureCrashReporter(){const n=process.env.VSCODE_CRASH_REPORTER_START_OPTIONS;if(typeof n=="string")try{const i=JSON.parse(n);i&&process.crashReporter&&process.crashReporter.start(i)}catch(i){console.error(i)}} //# sourceMappingURL=bootstrap-fork.js.map