mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-06-15 08:36:33 +00:00
fix: incorrect certificate flashing command string (#2181)
Use a `string` array of command flags instead of the concatenated final `string` command. Ref: arduino/arduino-ide#2067 Closes arduino/arduino-ide#2179 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
This commit is contained in:
parent
b25665561e
commit
9a99957e73
@ -16,7 +16,10 @@ import {
|
|||||||
arduinoCert,
|
arduinoCert,
|
||||||
certificateList,
|
certificateList,
|
||||||
} from '../dialogs/certificate-uploader/utils';
|
} from '../dialogs/certificate-uploader/utils';
|
||||||
import { ArduinoFirmwareUploader } from '../../common/protocol/arduino-firmware-uploader';
|
import {
|
||||||
|
ArduinoFirmwareUploader,
|
||||||
|
UploadCertificateParams,
|
||||||
|
} from '../../common/protocol/arduino-firmware-uploader';
|
||||||
import { nls } from '@theia/core/lib/common';
|
import { nls } from '@theia/core/lib/common';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
@ -74,12 +77,8 @@ export class UploadCertificate extends Contribution {
|
|||||||
});
|
});
|
||||||
|
|
||||||
registry.registerCommand(UploadCertificate.Commands.UPLOAD_CERT, {
|
registry.registerCommand(UploadCertificate.Commands.UPLOAD_CERT, {
|
||||||
execute: async ({ fqbn, address, urls }) => {
|
execute: async (params: UploadCertificateParams) => {
|
||||||
return this.arduinoFirmwareUploader.uploadCertificates(
|
return this.arduinoFirmwareUploader.uploadCertificates(params);
|
||||||
`-b ${fqbn} -a ${address} ${urls
|
|
||||||
.map((url: string) => `-u ${url}`)
|
|
||||||
.join(' ')}`
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,19 +1,24 @@
|
|||||||
import { Port } from "./boards-service";
|
import type { Port } from './boards-service';
|
||||||
|
|
||||||
export const ArduinoFirmwareUploaderPath =
|
export const ArduinoFirmwareUploaderPath =
|
||||||
'/services/arduino-firmware-uploader';
|
'/services/arduino-firmware-uploader';
|
||||||
export const ArduinoFirmwareUploader = Symbol('ArduinoFirmwareUploader');
|
export const ArduinoFirmwareUploader = Symbol('ArduinoFirmwareUploader');
|
||||||
export type FirmwareInfo = {
|
export interface FirmwareInfo {
|
||||||
board_name: string;
|
board_name: string;
|
||||||
board_fqbn: string;
|
board_fqbn: string;
|
||||||
module: string;
|
module: string;
|
||||||
firmware_version: string;
|
firmware_version: string;
|
||||||
Latest: boolean;
|
Latest: boolean;
|
||||||
};
|
}
|
||||||
|
export interface UploadCertificateParams {
|
||||||
|
readonly fqbn: string;
|
||||||
|
readonly address: string;
|
||||||
|
readonly urls: readonly string[];
|
||||||
|
}
|
||||||
export interface ArduinoFirmwareUploader {
|
export interface ArduinoFirmwareUploader {
|
||||||
list(fqbn?: string): Promise<FirmwareInfo[]>;
|
list(fqbn?: string): Promise<FirmwareInfo[]>;
|
||||||
flash(firmware: FirmwareInfo, port: Port): Promise<string>;
|
flash(firmware: FirmwareInfo, port: Port): Promise<string>;
|
||||||
uploadCertificates(command: string): Promise<any>;
|
uploadCertificates(params: UploadCertificateParams): Promise<unknown>;
|
||||||
updatableBoards(): Promise<string[]>;
|
updatableBoards(): Promise<string[]>;
|
||||||
availableFirmwares(fqbn: string): Promise<FirmwareInfo[]>;
|
availableFirmwares(fqbn: string): Promise<FirmwareInfo[]>;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import type { Port } from '../common/protocol';
|
|||||||
import {
|
import {
|
||||||
ArduinoFirmwareUploader,
|
ArduinoFirmwareUploader,
|
||||||
FirmwareInfo,
|
FirmwareInfo,
|
||||||
|
UploadCertificateParams,
|
||||||
} from '../common/protocol/arduino-firmware-uploader';
|
} from '../common/protocol/arduino-firmware-uploader';
|
||||||
import { spawnCommand } from './exec-util';
|
import { spawnCommand } from './exec-util';
|
||||||
import { MonitorManager } from './monitor-manager';
|
import { MonitorManager } from './monitor-manager';
|
||||||
@ -17,8 +18,17 @@ export class ArduinoFirmwareUploaderImpl implements ArduinoFirmwareUploader {
|
|||||||
@inject(MonitorManager)
|
@inject(MonitorManager)
|
||||||
private readonly monitorManager: MonitorManager;
|
private readonly monitorManager: MonitorManager;
|
||||||
|
|
||||||
async uploadCertificates(command: string): Promise<string> {
|
async uploadCertificates(params: UploadCertificateParams): Promise<string> {
|
||||||
return await this.runCommand(['certificates', 'flash', command]);
|
const { fqbn, address, urls } = params;
|
||||||
|
return await this.runCommand([
|
||||||
|
'certificates',
|
||||||
|
'flash',
|
||||||
|
'-b',
|
||||||
|
fqbn,
|
||||||
|
'-a',
|
||||||
|
address,
|
||||||
|
...urls.flatMap((url) => ['-u', url]),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async list(fqbn?: string): Promise<FirmwareInfo[]> {
|
async list(fqbn?: string): Promise<FirmwareInfo[]> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user