mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-26 12:46:36 +00:00
Fixed lib uninstall. Do not log it more than once.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
0a8b6bc41e
commit
62b18ccbed
@ -2,7 +2,17 @@ import * as PQueue from 'p-queue';
|
|||||||
import { injectable, inject, postConstruct, named } from 'inversify';
|
import { injectable, inject, postConstruct, named } from 'inversify';
|
||||||
import { ILogger } from '@theia/core/lib/common/logger';
|
import { ILogger } from '@theia/core/lib/common/logger';
|
||||||
import { BoardsService, AttachedSerialBoard, BoardPackage, Board, AttachedNetworkBoard, BoardsServiceClient, Port } from '../common/protocol/boards-service';
|
import { BoardsService, AttachedSerialBoard, BoardPackage, Board, AttachedNetworkBoard, BoardsServiceClient, Port } from '../common/protocol/boards-service';
|
||||||
import { PlatformSearchReq, PlatformSearchResp, PlatformInstallReq, PlatformInstallResp, PlatformListReq, PlatformListResp, Platform, PlatformUninstallReq } from './cli-protocol/commands/core_pb';
|
import {
|
||||||
|
PlatformSearchReq,
|
||||||
|
PlatformSearchResp,
|
||||||
|
PlatformInstallReq,
|
||||||
|
PlatformInstallResp,
|
||||||
|
PlatformListReq,
|
||||||
|
PlatformListResp,
|
||||||
|
Platform,
|
||||||
|
PlatformUninstallReq,
|
||||||
|
PlatformUninstallResp
|
||||||
|
} from './cli-protocol/commands/core_pb';
|
||||||
import { CoreClientProvider } from './core-client-provider';
|
import { CoreClientProvider } from './core-client-provider';
|
||||||
import { BoardListReq, BoardListResp } from './cli-protocol/commands/board_pb';
|
import { BoardListReq, BoardListResp } from './cli-protocol/commands/board_pb';
|
||||||
import { ToolOutputServiceServer } from '../common/protocol/tool-output-service';
|
import { ToolOutputServiceServer } from '../common/protocol/tool-output-service';
|
||||||
@ -304,13 +314,14 @@ export class BoardsServiceImpl implements BoardsService {
|
|||||||
req.setPlatformPackage(platform);
|
req.setPlatformPackage(platform);
|
||||||
|
|
||||||
console.info("Starting board uninstallation", pkg);
|
console.info("Starting board uninstallation", pkg);
|
||||||
|
let logged = false;
|
||||||
const resp = client.platformUninstall(req);
|
const resp = client.platformUninstall(req);
|
||||||
resp.on('data', (r: PlatformInstallResp) => {
|
resp.on('data', (_: PlatformUninstallResp) => {
|
||||||
const prog = r.getProgress();
|
if (!logged) {
|
||||||
if (prog && prog.getFile()) {
|
this.toolOutputService.publishNewOutput("board uninstall", `uninstalling ${pkg.id}\n`)
|
||||||
this.toolOutputService.publishNewOutput("board uninstall", `uninstalling ${prog.getFile()}\n`)
|
logged = true;
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
resp.on('end', resolve);
|
resp.on('end', resolve);
|
||||||
resp.on('error', reject);
|
resp.on('error', reject);
|
||||||
|
@ -2,8 +2,16 @@ import { injectable, inject } from 'inversify';
|
|||||||
import { Library, LibraryService } from '../common/protocol/library-service';
|
import { Library, LibraryService } from '../common/protocol/library-service';
|
||||||
import { CoreClientProvider } from './core-client-provider';
|
import { CoreClientProvider } from './core-client-provider';
|
||||||
import {
|
import {
|
||||||
LibrarySearchReq, LibrarySearchResp, LibraryListReq, LibraryListResp, LibraryRelease,
|
LibrarySearchReq,
|
||||||
InstalledLibrary, LibraryInstallReq, LibraryInstallResp, LibraryUninstallReq
|
LibrarySearchResp,
|
||||||
|
LibraryListReq,
|
||||||
|
LibraryListResp,
|
||||||
|
LibraryRelease,
|
||||||
|
InstalledLibrary,
|
||||||
|
LibraryInstallReq,
|
||||||
|
LibraryInstallResp,
|
||||||
|
LibraryUninstallReq,
|
||||||
|
LibraryUninstallResp
|
||||||
} from './cli-protocol/commands/lib_pb';
|
} from './cli-protocol/commands/lib_pb';
|
||||||
import { ToolOutputServiceServer } from '../common/protocol/tool-output-service';
|
import { ToolOutputServiceServer } from '../common/protocol/tool-output-service';
|
||||||
import { Installable } from '../common/protocol/installable';
|
import { Installable } from '../common/protocol/installable';
|
||||||
@ -103,11 +111,12 @@ export class LibraryServiceImpl implements LibraryService {
|
|||||||
req.setName(library.name);
|
req.setName(library.name);
|
||||||
req.setVersion(library.installedVersion!);
|
req.setVersion(library.installedVersion!);
|
||||||
|
|
||||||
const resp = client.libraryInstall(req);
|
let logged = false;
|
||||||
resp.on('data', (r: LibraryInstallResp) => {
|
const resp = client.libraryUninstall(req);
|
||||||
const prog = r.getProgress();
|
resp.on('data', (_: LibraryUninstallResp) => {
|
||||||
if (prog) {
|
if (!logged) {
|
||||||
this.toolOutputService.publishNewOutput("library uninstall", `uninstalling ${prog.getFile()}: ${prog.getCompleted()}%\n`)
|
this.toolOutputService.publishNewOutput("library uninstall", `uninstalling ${library.name}:${library.installedVersion}%\n`)
|
||||||
|
logged = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
await new Promise<void>((resolve, reject) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user