Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async start(clientConnection: IConnection): Promise {
// Same as https://github.com/eclipse-theia/theia/commit/de45794a90fc1a1a590578026f8ad527127afa0a
const command = process.execPath;
const args: string[] = [
path.resolve(__dirname, './json-starter'),
'--stdio'
];
const serverConnection = await this.createProcessStreamConnectionAsync(command, args, { env: environment.electron.runAsNodeEnv() });
this.forward(clientConnection, serverConnection);
}
private childProcess(executable: DebugAdapterExecutable): RawProcess {
// tslint:disable-next-line:no-any
const isForkOptions = (forkOptions: RawForkOptions | any): forkOptions is RawForkOptions =>
!!forkOptions && !!forkOptions.modulePath;
const processOptions: RawProcessOptions | RawForkOptions = { ...executable };
const options: { stdio: (string | number)[], env?: object, execArgv?: string[] } = { stdio: ['pipe', 'pipe', 2] };
if (isForkOptions(processOptions)) {
options.stdio.push('ipc');
options.env = environment.electron.runAsNodeEnv();
options.execArgv = (executable as DebugAdapterForkExecutable).execArgv;
}
processOptions.options = options;
return this.processFactory(processOptions);
}
async start(clientConnection: IConnection, { parameters }: TypeScriptStartOptions): Promise {
// Re-use the same tool used to launch Theia. e.g. for an Electron Theia packaging,
// this will be "electron" executable that is bundled with the application.
const command = process.execPath;
const args: string[] = [
path.join(__dirname, 'startserver.js'),
'--stdio'
];
const tsServerPath = TypescriptVersionURI.getTsServerPath(parameters && parameters.version);
if (tsServerPath) {
args.push(`--tsserver-path=${tsServerPath}`);
}
const serverConnection = await this.createProcessStreamConnectionAsync(command, args, { env: environment.electron.runAsNodeEnv() });
this.forward(clientConnection, serverConnection);
}