/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/
function queueProcessExit(){closeTimeout=setTimeout(function(){ptyProcess.kill(),process.exit(exitCode)},250)}function getArgs(){if(process.env.PTYSHELLCMDLINE)return process.env.PTYSHELLCMDLINE;for(var e=[],s=0;process.env["PTYSHELLARG"+s];)e.push(process.env["PTYSHELLARG"+s]),s++;return e}function cleanEnv(){["ELECTRON_RUN_AS_NODE","PTYCWD","PTYPID","PTYSHELL","PTYCOLS","PTYROWS","PTYSHELLCMDLINE"].forEach(function(e){process.env[e]&&delete process.env[e]});for(;process.env.PTYSHELLARG0;)delete process.env.PTYSHELLARG0}function setupPlanB(e){setInterval(function(){try{process.kill(e,0)}catch(e){process.exit()}},5e3)}function sendProcessId(){process.send({type:"pid",content:ptyProcess.pid})}function setupTitlePolling(){sendProcessTitle(),setInterval(function(){currentTitle!==ptyProcess.process&&sendProcessTitle()},200)}function sendProcessTitle(){process.send({type:"title",content:ptyProcess.process}),currentTitle=ptyProcess.process}var fs=require("fs"),os=require("os"),path=require("path"),ptyJs=require("node-pty"),name;name="win32"===os.platform()?path.basename(process.env.PTYSHELL):"xterm-256color";var shell=process.env.PTYSHELL,args=getArgs(),cwd=process.env.PTYCWD,cols=process.env.PTYCOLS,rows=process.env.PTYROWS,currentTitle="";setupPlanB(process.env.PTYPID),cleanEnv();var options={name:name,cwd:cwd};cols&&rows&&(options.cols=parseInt(cols,10),options.rows=parseInt(rows,10));var ptyProcess=ptyJs.fork(shell,args,options),closeTimeout,exitCode;ptyProcess.on("data",function(e){process.send({type:"data",content:e}),closeTimeout&&(clearTimeout(closeTimeout),queueProcessExit())}),ptyProcess.on("exit",function(e){exitCode=e,queueProcessExit()}),process.on("message",function(e){"input"===e.event?ptyProcess.write(e.data):"resize"===e.event&&ptyProcess.resize(e.cols,e.rows)}),sendProcessId(),setupTitlePolling();
//# sourceMappingURL=https://ticino.blob.core.windows.net/sourcemaps/f6868fce3eeb16663840eb82123369dec6077a9b/core/vs\workbench\parts\terminal\electron-browser\terminalProcess.js.map
