1 | static Map<Int, S> psPidsAndCommands() { |
2 | if (isWindows()) fail("Unix only"); |
3 | S psOutput = backtick("ps -aef"); |
4 | L<S> lines = toLines(psOutput); |
5 | S header = lines.get(0); |
6 | L<S> body = dropFirst(lines); |
7 | final int i1 = header.indexOf(" PID"); |
8 | final int i2 = header.indexOf("CMD"); |
9 | ret pairsToTreeMap(map(func(S s) -> Pair<Int, S> { |
10 | pair(parseInt(trim(substring(s, i1-2, i1+4))), substring(s, i2).trim()) |
11 | }, body)); |
12 | } |
Began life as a copy of #1004979
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1009581 |
Snippet name: | psPidsAndCommands - parse output of "ps -aef" |
Eternal ID of this version: | #1009581/4 |
Text MD5: | 401edb8e643b2ff0ffa117cf6a510ce7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-02 12:58:06 |
Source code size: | 443 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 510 / 557 |
Version history: | 3 change(s) |
Referenced in: | [show references] |