fix(network): duplicate networks overwrite activity status
jq consumes first line without -n
This commit is contained in:
parent
90aa8fc0ea
commit
e96f10d9a9
1 changed files with 4 additions and 2 deletions
|
|
@ -23,10 +23,12 @@ Singleton {
|
|||
Process {
|
||||
id: getNetworks
|
||||
running: true
|
||||
command: ["sh", "-c", `nmcli -g ACTIVE,SIGNAL,FREQ,SSID d w | jq -cR '[(inputs / ":") | select(.[3] | length >= 4)]'`]
|
||||
command: ["sh", "-c", `nmcli -g ACTIVE,SIGNAL,FREQ,SSID d w | jq -ncR '[(inputs / ":") | select(.[3] | length >= 4)]'`]
|
||||
stdout: SplitParser {
|
||||
onRead: data => {
|
||||
const networks = JSON.parse(data).map(n => [n[0] === "yes", parseInt(n[1]), parseInt(n[2]), n[3]]);
|
||||
const networks = JSON.parse(data)
|
||||
.filter(n => n[0] === "yes")
|
||||
.map(n => [n[0] === "yes", parseInt(n[1]), parseInt(n[2]), n[3]]);
|
||||
const rNetworks = root.networks;
|
||||
|
||||
const destroyed = rNetworks.filter(rn => !networks.find(n => n[2] === rn.frequency && n[3] === rn.ssid));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue