Skip to content

Commit 5de6668

Browse files
Fixes logging output when using JMESPath queries. Closes #2095
1 parent 6f28543 commit 5de6668

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/cli/Cli.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ export class Cli {
359359
return logStatement.toString();
360360
}
361361

362-
const logStatementType: string = typeof logStatement;
362+
let logStatementType: string = typeof logStatement;
363363

364364
if (logStatementType === 'undefined') {
365365
return logStatement;
@@ -376,6 +376,10 @@ export class Cli {
376376
!options.help) {
377377
const jmespath: typeof JMESPath = require('jmespath');
378378
logStatement = jmespath.search(logStatement, options.query);
379+
// we need to update the statement type in case the JMESPath query
380+
// returns an object of different shape than the original message to log
381+
// #2095
382+
logStatementType = typeof logStatement;
379383
}
380384

381385
if (options.output === 'json') {

0 commit comments

Comments
 (0)