Skip to content

Commit ec24b68

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
fix: use text --format for the CLI
`Can't write debug log: available only in text format` error is thrown by the CLI if the `--debug` flag is present. Ref: arduino/arduino-cli#2003 Closes #1942 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent d398ed1 commit ec24b68

File tree

7 files changed

+389
-25
lines changed

7 files changed

+389
-25
lines changed

arduino-ide-extension/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@
164164
],
165165
"arduino": {
166166
"cli": {
167-
"version": "0.31.0"
167+
"version": {
168+
"owner": "arduino",
169+
"repo": "arduino-cli",
170+
"commitish": "6992de7"
171+
}
168172
},
169173
"fwuploader": {
170174
"version": "2.2.2"

arduino-ide-extension/src/node/arduino-daemon-impl.ts

+19-22
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ export class ArduinoDaemonImpl
136136
const cliConfigPath = join(FileUri.fsPath(configDirUri), CLI_CONFIG);
137137
const args = [
138138
'daemon',
139-
'--format',
140-
'jsonmini',
141139
'--port',
142140
'0',
143141
'--config-file',
@@ -177,26 +175,6 @@ export class ArduinoDaemonImpl
177175

178176
daemon.stdout.on('data', (data) => {
179177
const message = data.toString();
180-
181-
let port = '';
182-
let address = '';
183-
message
184-
.split('\n')
185-
.filter((line: string) => line.length)
186-
.forEach((line: string) => {
187-
try {
188-
const parsedLine = JSON.parse(line);
189-
if ('Port' in parsedLine) {
190-
port = parsedLine.Port;
191-
}
192-
if ('IP' in parsedLine) {
193-
address = parsedLine.IP;
194-
}
195-
} catch (err) {
196-
// ignore
197-
}
198-
});
199-
200178
this.onData(message);
201179
if (!grpcServerIsReady) {
202180
const error = DaemonError.parse(message);
@@ -205,6 +183,25 @@ export class ArduinoDaemonImpl
205183
return;
206184
}
207185

186+
let port = '';
187+
let address = '';
188+
message
189+
.split('\n')
190+
.filter((line: string) => line.length)
191+
.forEach((line: string) => {
192+
try {
193+
const parsedLine = JSON.parse(line);
194+
if ('Port' in parsedLine) {
195+
port = parsedLine.Port;
196+
}
197+
if ('IP' in parsedLine) {
198+
address = parsedLine.IP;
199+
}
200+
} catch (err) {
201+
// ignore
202+
}
203+
});
204+
208205
if (port.length && address.length) {
209206
grpcServerIsReady = true;
210207
ready.resolve({ daemon, port });

arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js

-2
Original file line numberDiff line numberDiff line change
@@ -1333,5 +1333,3 @@ enumerateMonitorPortSettings: {
13331333
},
13341334
};
13351335

1336-
// BOOTSTRAP COMMANDS
1337-
// -------------------

arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.d.ts

+32
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,31 @@ export namespace InitResponse {
172172

173173
}
174174

175+
export class FailedInstanceInitError extends jspb.Message {
176+
getReason(): FailedInstanceInitReason;
177+
setReason(value: FailedInstanceInitReason): FailedInstanceInitError;
178+
179+
getMessage(): string;
180+
setMessage(value: string): FailedInstanceInitError;
181+
182+
183+
serializeBinary(): Uint8Array;
184+
toObject(includeInstance?: boolean): FailedInstanceInitError.AsObject;
185+
static toObject(includeInstance: boolean, msg: FailedInstanceInitError): FailedInstanceInitError.AsObject;
186+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
187+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
188+
static serializeBinaryToWriter(message: FailedInstanceInitError, writer: jspb.BinaryWriter): void;
189+
static deserializeBinary(bytes: Uint8Array): FailedInstanceInitError;
190+
static deserializeBinaryFromReader(message: FailedInstanceInitError, reader: jspb.BinaryReader): FailedInstanceInitError;
191+
}
192+
193+
export namespace FailedInstanceInitError {
194+
export type AsObject = {
195+
reason: FailedInstanceInitReason,
196+
message: string,
197+
}
198+
}
199+
175200
export class DestroyRequest extends jspb.Message {
176201

177202
hasInstance(): boolean;
@@ -528,3 +553,10 @@ export namespace ArchiveSketchResponse {
528553
export type AsObject = {
529554
}
530555
}
556+
557+
export enum FailedInstanceInitReason {
558+
FAILED_INSTANCE_INIT_REASON_UNSPECIFIED = 0,
559+
FAILED_INSTANCE_INIT_REASON_INVALID_INDEX_URL = 1,
560+
FAILED_INSTANCE_INIT_REASON_INDEX_LOAD_ERROR = 2,
561+
FAILED_INSTANCE_INIT_REASON_TOOL_LOAD_ERROR = 3,
562+
}

arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.js

+193
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.v1.CreateRequest', null, global
3737
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.CreateResponse', null, global);
3838
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.DestroyRequest', null, global);
3939
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.DestroyResponse', null, global);
40+
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.FailedInstanceInitError', null, global);
41+
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.FailedInstanceInitReason', null, global);
4042
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.InitRequest', null, global);
4143
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.InitResponse', null, global);
4244
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.InitResponse.MessageCase', null, global);
@@ -156,6 +158,27 @@ if (goog.DEBUG && !COMPILED) {
156158
*/
157159
proto.cc.arduino.cli.commands.v1.InitResponse.Progress.displayName = 'proto.cc.arduino.cli.commands.v1.InitResponse.Progress';
158160
}
161+
/**
162+
* Generated by JsPbCodeGenerator.
163+
* @param {Array=} opt_data Optional initial data array, typically from a
164+
* server response, or constructed directly in Javascript. The array is used
165+
* in place and becomes part of the constructed object. It is not cloned.
166+
* If no data is provided, the constructed object will be empty, but still
167+
* valid.
168+
* @extends {jspb.Message}
169+
* @constructor
170+
*/
171+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError = function(opt_data) {
172+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
173+
};
174+
goog.inherits(proto.cc.arduino.cli.commands.v1.FailedInstanceInitError, jspb.Message);
175+
if (goog.DEBUG && !COMPILED) {
176+
/**
177+
* @public
178+
* @override
179+
*/
180+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.displayName = 'proto.cc.arduino.cli.commands.v1.FailedInstanceInitError';
181+
}
159182
/**
160183
* Generated by JsPbCodeGenerator.
161184
* @param {Array=} opt_data Optional initial data array, typically from a
@@ -1398,6 +1421,166 @@ proto.cc.arduino.cli.commands.v1.InitResponse.prototype.hasProfile = function()
13981421

13991422

14001423

1424+
if (jspb.Message.GENERATE_TO_OBJECT) {
1425+
/**
1426+
* Creates an object representation of this proto.
1427+
* Field names that are reserved in JavaScript and will be renamed to pb_name.
1428+
* Optional fields that are not set will be set to undefined.
1429+
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
1430+
* For the list of reserved names please see:
1431+
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
1432+
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
1433+
* JSPB instance for transitional soy proto support:
1434+
* http://goto/soy-param-migration
1435+
* @return {!Object}
1436+
*/
1437+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.prototype.toObject = function(opt_includeInstance) {
1438+
return proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.toObject(opt_includeInstance, this);
1439+
};
1440+
1441+
1442+
/**
1443+
* Static version of the {@see toObject} method.
1444+
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
1445+
* the JSPB instance for transitional soy proto support:
1446+
* http://goto/soy-param-migration
1447+
* @param {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitError} msg The msg instance to transform.
1448+
* @return {!Object}
1449+
* @suppress {unusedLocalVariables} f is only used for nested messages
1450+
*/
1451+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.toObject = function(includeInstance, msg) {
1452+
var f, obj = {
1453+
reason: jspb.Message.getFieldWithDefault(msg, 1, 0),
1454+
message: jspb.Message.getFieldWithDefault(msg, 2, "")
1455+
};
1456+
1457+
if (includeInstance) {
1458+
obj.$jspbMessageInstance = msg;
1459+
}
1460+
return obj;
1461+
};
1462+
}
1463+
1464+
1465+
/**
1466+
* Deserializes binary data (in protobuf wire format).
1467+
* @param {jspb.ByteSource} bytes The bytes to deserialize.
1468+
* @return {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitError}
1469+
*/
1470+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.deserializeBinary = function(bytes) {
1471+
var reader = new jspb.BinaryReader(bytes);
1472+
var msg = new proto.cc.arduino.cli.commands.v1.FailedInstanceInitError;
1473+
return proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.deserializeBinaryFromReader(msg, reader);
1474+
};
1475+
1476+
1477+
/**
1478+
* Deserializes binary data (in protobuf wire format) from the
1479+
* given reader into the given message object.
1480+
* @param {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitError} msg The message object to deserialize into.
1481+
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
1482+
* @return {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitError}
1483+
*/
1484+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.deserializeBinaryFromReader = function(msg, reader) {
1485+
while (reader.nextField()) {
1486+
if (reader.isEndGroup()) {
1487+
break;
1488+
}
1489+
var field = reader.getFieldNumber();
1490+
switch (field) {
1491+
case 1:
1492+
var value = /** @type {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitReason} */ (reader.readEnum());
1493+
msg.setReason(value);
1494+
break;
1495+
case 2:
1496+
var value = /** @type {string} */ (reader.readString());
1497+
msg.setMessage(value);
1498+
break;
1499+
default:
1500+
reader.skipField();
1501+
break;
1502+
}
1503+
}
1504+
return msg;
1505+
};
1506+
1507+
1508+
/**
1509+
* Serializes the message to binary data (in protobuf wire format).
1510+
* @return {!Uint8Array}
1511+
*/
1512+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.prototype.serializeBinary = function() {
1513+
var writer = new jspb.BinaryWriter();
1514+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.serializeBinaryToWriter(this, writer);
1515+
return writer.getResultBuffer();
1516+
};
1517+
1518+
1519+
/**
1520+
* Serializes the given message to binary data (in protobuf wire
1521+
* format), writing to the given BinaryWriter.
1522+
* @param {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitError} message
1523+
* @param {!jspb.BinaryWriter} writer
1524+
* @suppress {unusedLocalVariables} f is only used for nested messages
1525+
*/
1526+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.serializeBinaryToWriter = function(message, writer) {
1527+
var f = undefined;
1528+
f = message.getReason();
1529+
if (f !== 0.0) {
1530+
writer.writeEnum(
1531+
1,
1532+
f
1533+
);
1534+
}
1535+
f = message.getMessage();
1536+
if (f.length > 0) {
1537+
writer.writeString(
1538+
2,
1539+
f
1540+
);
1541+
}
1542+
};
1543+
1544+
1545+
/**
1546+
* optional FailedInstanceInitReason reason = 1;
1547+
* @return {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitReason}
1548+
*/
1549+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.prototype.getReason = function() {
1550+
return /** @type {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitReason} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
1551+
};
1552+
1553+
1554+
/**
1555+
* @param {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitReason} value
1556+
* @return {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitError} returns this
1557+
*/
1558+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.prototype.setReason = function(value) {
1559+
return jspb.Message.setProto3EnumField(this, 1, value);
1560+
};
1561+
1562+
1563+
/**
1564+
* optional string message = 2;
1565+
* @return {string}
1566+
*/
1567+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.prototype.getMessage = function() {
1568+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
1569+
};
1570+
1571+
1572+
/**
1573+
* @param {string} value
1574+
* @return {!proto.cc.arduino.cli.commands.v1.FailedInstanceInitError} returns this
1575+
*/
1576+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitError.prototype.setMessage = function(value) {
1577+
return jspb.Message.setProto3StringField(this, 2, value);
1578+
};
1579+
1580+
1581+
1582+
1583+
14011584
if (jspb.Message.GENERATE_TO_OBJECT) {
14021585
/**
14031586
* Creates an object representation of this proto.
@@ -3699,4 +3882,14 @@ proto.cc.arduino.cli.commands.v1.ArchiveSketchResponse.serializeBinaryToWriter =
36993882
};
37003883

37013884

3885+
/**
3886+
* @enum {number}
3887+
*/
3888+
proto.cc.arduino.cli.commands.v1.FailedInstanceInitReason = {
3889+
FAILED_INSTANCE_INIT_REASON_UNSPECIFIED: 0,
3890+
FAILED_INSTANCE_INIT_REASON_INVALID_INDEX_URL: 1,
3891+
FAILED_INSTANCE_INIT_REASON_INDEX_LOAD_ERROR: 2,
3892+
FAILED_INSTANCE_INIT_REASON_TOOL_LOAD_ERROR: 3
3893+
};
3894+
37023895
goog.object.extend(exports, proto.cc.arduino.cli.commands.v1);

arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/core_pb.d.ts

+17
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,23 @@ export namespace PlatformInstallResponse {
8282
}
8383
}
8484

85+
export class PlatformLoadingError extends jspb.Message {
86+
87+
serializeBinary(): Uint8Array;
88+
toObject(includeInstance?: boolean): PlatformLoadingError.AsObject;
89+
static toObject(includeInstance: boolean, msg: PlatformLoadingError): PlatformLoadingError.AsObject;
90+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
91+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
92+
static serializeBinaryToWriter(message: PlatformLoadingError, writer: jspb.BinaryWriter): void;
93+
static deserializeBinary(bytes: Uint8Array): PlatformLoadingError;
94+
static deserializeBinaryFromReader(message: PlatformLoadingError, reader: jspb.BinaryReader): PlatformLoadingError;
95+
}
96+
97+
export namespace PlatformLoadingError {
98+
export type AsObject = {
99+
}
100+
}
101+
85102
export class PlatformDownloadRequest extends jspb.Message {
86103

87104
hasInstance(): boolean;

0 commit comments

Comments
 (0)