-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
I found some of ps -lx log crash the output
import Parser from 'table-parser'
const log = `
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
1 1000 22896 1 20 0 862556 2020 hrtime Ss ? 0:44 /home/user/server/sbin/agent -i /home/user/server/etc/agent.conf -d
`
console.log(Parser.parse(log)) // work perfect!but when I add a log below, the output getting odd...
1 1000 37155 37142 20 0 1418072 613332 hrtime Sl ? 11719:38 /home/user/sbin/otherAgent -i /home/user/etc/otherAgent.confimport Parser from 'table-parser'
const new_log = `
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
1 1000 22896 1 20 0 862556 2020 hrtime Ss ? 0:44 /home/user/server/sbin/agent -i /home/user/server/etc/agent.conf -d
1 1000 37155 37142 20 0 1418072 613332 hrtime Sl ? 11719:38 /home/user/sbin/otherAgent -i /home/user/etc/otherAgent.conf
`
console.log(Parser.parse(new_log))
/*
{
COMMAND: ["0:44", "/home/user/server/sbin/agent"],
TIME: ["0:44", "/home/user/server/sbin/agent", "-i", "/home/user/server/etc/agent.conf", "-d"]
}
*/here is demo
table-parser v1.0.1
Metadata
Metadata
Assignees
Labels
No labels