IDE to run CLI with auto assigned port (#673)

* get daemon port from CLI stdout

* config-service to use CLI daemon port

* updating LS

* fixed tests

* fix upload blocked when selectedBoard.port is undefined

* bump arduino-cli to 0.20.2

Co-authored-by: Alberto Iannaccone <a.iannaccone@arduino.cc>
This commit is contained in:
Francesco Stasi
2021-12-09 15:08:26 +01:00
committed by GitHub
parent 767b09d2f1
commit 49d12d99ff
10 changed files with 88 additions and 75 deletions

View File

@@ -21,8 +21,7 @@ export abstract class GrpcClientProvider<C> {
@postConstruct()
protected init(): void {
const updateClient = () => {
const cliConfig = this.configService.cliConfiguration;
this.reconcileClient(cliConfig ? cliConfig.daemon.port : undefined);
this.reconcileClient();
};
this.configService.onConfigChange(updateClient);
this.daemon.ready.then(updateClient);
@@ -44,9 +43,9 @@ export abstract class GrpcClientProvider<C> {
}
}
protected async reconcileClient(
port: string | number | undefined
): Promise<void> {
protected async reconcileClient(): Promise<void> {
const port = await this.daemon.getPort();
if (this._port === port) {
return; // Nothing to do.
}