mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-04-19 12:57:17 +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,
|
||||
certificateList,
|
||||
} 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';
|
||||
|
||||
@injectable()
|
||||
@ -74,12 +77,8 @@ export class UploadCertificate extends Contribution {
|
||||
});
|
||||
|
||||
registry.registerCommand(UploadCertificate.Commands.UPLOAD_CERT, {
|
||||
execute: async ({ fqbn, address, urls }) => {
|
||||
return this.arduinoFirmwareUploader.uploadCertificates(
|
||||
`-b ${fqbn} -a ${address} ${urls
|
||||
.map((url: string) => `-u ${url}`)
|
||||
.join(' ')}`
|
||||
);
|
||||
execute: async (params: UploadCertificateParams) => {
|
||||
return this.arduinoFirmwareUploader.uploadCertificates(params);
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -1,19 +1,24 @@
|
||||
import { Port } from "./boards-service";
|
||||
import type { Port } from './boards-service';
|
||||
|
||||
export const ArduinoFirmwareUploaderPath =
|
||||
'/services/arduino-firmware-uploader';
|
||||
export const ArduinoFirmwareUploader = Symbol('ArduinoFirmwareUploader');
|
||||
export type FirmwareInfo = {
|
||||
export interface FirmwareInfo {
|
||||
board_name: string;
|
||||
board_fqbn: string;
|
||||
module: string;
|
||||
firmware_version: string;
|
||||
Latest: boolean;
|
||||
};
|
||||
}
|
||||
export interface UploadCertificateParams {
|
||||
readonly fqbn: string;
|
||||
readonly address: string;
|
||||
readonly urls: readonly string[];
|
||||
}
|
||||
export interface ArduinoFirmwareUploader {
|
||||
list(fqbn?: string): Promise<FirmwareInfo[]>;
|
||||
flash(firmware: FirmwareInfo, port: Port): Promise<string>;
|
||||
uploadCertificates(command: string): Promise<any>;
|
||||
uploadCertificates(params: UploadCertificateParams): Promise<unknown>;
|
||||
updatableBoards(): Promise<string[]>;
|
||||
availableFirmwares(fqbn: string): Promise<FirmwareInfo[]>;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import type { Port } from '../common/protocol';
|
||||
import {
|
||||
ArduinoFirmwareUploader,
|
||||
FirmwareInfo,
|
||||
UploadCertificateParams,
|
||||
} from '../common/protocol/arduino-firmware-uploader';
|
||||
import { spawnCommand } from './exec-util';
|
||||
import { MonitorManager } from './monitor-manager';
|
||||
@ -17,8 +18,17 @@ export class ArduinoFirmwareUploaderImpl implements ArduinoFirmwareUploader {
|
||||
@inject(MonitorManager)
|
||||
private readonly monitorManager: MonitorManager;
|
||||
|
||||
async uploadCertificates(command: string): Promise<string> {
|
||||
return await this.runCommand(['certificates', 'flash', command]);
|
||||
async uploadCertificates(params: UploadCertificateParams): Promise<string> {
|
||||
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[]> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user