in vscode/qodana/src/core/cli/executor.ts [38:68]
export async function launchTerminal(cli: string, cwd: string, tempDir: string, token: string | undefined): Promise<number | undefined> {
let options: vscode.TerminalOptions = {
env: {
// eslint-disable-next-line @typescript-eslint/naming-convention
QODANA_TOKEN: token,
// eslint-disable-next-line @typescript-eslint/naming-convention
NONINTERACTIVE: '1'
},
cwd: cwd,
name: 'Qodana CLI',
};
let terminal = vscode.window.createTerminal(options);
terminal.show();
// cli could contain spaces in the path in the middle, they should be escaped (not for windows)
if (os.platform() === 'win32') {
cli = `& "${cli}"`;
tempDir = `"${tempDir}"`;
} else {
cli = cli.replace(/ /g, '\\ ');
}
terminal.sendText(`${cli} scan --results-dir ${tempDir}`, false);
terminal.sendText('; sleep 3; exit');
return new Promise(resolve => {
const dispose = vscode.window.onDidCloseTerminal(closedTerminal => {
if (closedTerminal === terminal) {
resolve(terminal.exitStatus?.code);
dispose.dispose();
}
});
});
}