Skip to content

some of ps -lx log crash the output #17

Description

@jasonliao

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.conf
import 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions