This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* parse output from 'resolvectl' or 'systemd-resolve --status' | |
* and outputs it in json format | |
*/ | |
const { execSync } = require("child_process"); | |
function resolvectl_parser_sync(){ | |
const cspr = execSync("systemd-resolve --status | sed -e 's/: /=/' | sed -e 's#[\t ]##g' | awk -F= 'BEGIN{section=\"\"}{if($2!=\"\"){section=$1\" \"; print $1\" \"$2}else if($1!=\"\") {print section$1} else {section=\"\"; print section}}' ").toString(); | |
var lines = cspr.split("\n"); |