mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
replace console with logService. For #84283
This commit is contained in:
@@ -11,6 +11,7 @@ import { IWindowOpenable } from 'vs/platform/windows/common/windows';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { INativeOpenWindowOptions } from 'vs/platform/windows/node/window';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
export interface OpenCommandPipeArgs {
|
||||
type: 'open';
|
||||
@@ -39,10 +40,10 @@ export class CLIServer {
|
||||
private _server: http.Server;
|
||||
private _ipcHandlePath: string | undefined;
|
||||
|
||||
constructor(@IExtHostCommands private _commands: IExtHostCommands) {
|
||||
constructor(@IExtHostCommands private _commands: IExtHostCommands, @ILogService private logService: ILogService) {
|
||||
this._server = http.createServer((req, res) => this.onRequest(req, res));
|
||||
this.setup().catch(err => {
|
||||
console.error(err);
|
||||
logService.error(err);
|
||||
return '';
|
||||
});
|
||||
}
|
||||
@@ -56,9 +57,9 @@ export class CLIServer {
|
||||
|
||||
try {
|
||||
this._server.listen(this.ipcHandlePath);
|
||||
this._server.on('error', err => console.error(err));
|
||||
this._server.on('error', err => this.logService.error(err));
|
||||
} catch (err) {
|
||||
console.error('Could not start open from terminal server.');
|
||||
this.logService.error('Could not start open from terminal server.');
|
||||
}
|
||||
|
||||
return this._ipcHandlePath;
|
||||
@@ -79,13 +80,13 @@ export class CLIServer {
|
||||
break;
|
||||
case 'command':
|
||||
this.runCommand(data, res)
|
||||
.catch(console.error);
|
||||
.catch(this.logService.error);
|
||||
break;
|
||||
default:
|
||||
res.writeHead(404);
|
||||
res.write(`Unknown message type: ${data.type}`, err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
this.logService.error(err);
|
||||
}
|
||||
});
|
||||
res.end();
|
||||
@@ -139,7 +140,7 @@ export class CLIServer {
|
||||
res.writeHead(500);
|
||||
res.write(String(err), err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
this.logService.error(err);
|
||||
}
|
||||
});
|
||||
res.end();
|
||||
@@ -153,7 +154,7 @@ export class CLIServer {
|
||||
res.writeHead(200);
|
||||
res.write(JSON.stringify(result), err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
this.logService.error(err);
|
||||
}
|
||||
});
|
||||
res.end();
|
||||
@@ -161,7 +162,7 @@ export class CLIServer {
|
||||
res.writeHead(500);
|
||||
res.write(String(err), err => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
this.logService.error(err);
|
||||
}
|
||||
});
|
||||
res.end();
|
||||
|
||||
Reference in New Issue
Block a user