static Map<Int, S> psPidsAndCommands() { if (isWindows()) fail("Unix only"); S psOutput = backtick("ps -aef"); L<S> lines = toLines(psOutput); S header = lines.get(0); L<S> body = dropFirst(lines); final int i1 = header.indexOf(" PID"); final int i2 = header.indexOf("CMD"); ret pairsToTreeMap(map(func(S s) -> Pair<Int, S> { pair(parseInt(trim(substring(s, i1-2, i1+4))), substring(s, i2).trim()) }, body)); }
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: | 509 / 555 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |