浏览代码

kamctl: catch one line jsonrpc result and just print it

- happening when json pretty printing is turned off
- filter_json() was breaking it by trying to format the output
Daniel-Constantin Mierla 8 年之前
父节点
当前提交
e4226212f5
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      utils/kamctl/kamctl.base

+ 1 - 0
utils/kamctl/kamctl.base

@@ -682,6 +682,7 @@ filter_json()
 	$AWK 'function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
 		BEGIN { line=0; IGNORECASE=1; }
 		{ line++; }
+		NR == 1 && /^{.+"id"[ \t]*:[ \t]*[0-9]+[ \t]*}$/ { print; next; }
 		NR == 1 && /^200 OK/ { next; }
 		/^[ \t]*"jsonrpc":[ \t]*"2.0"/ { print; next; }
 		/^[ \t]*"result":[ \t]*\[.+/ {