Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1009587 // unix_killAll - performs case-sensitive search in commands

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6165L/38K).

static L<Int> unix_killAll(S pattern, O... _) {
  ret unix_killAll(func(S s) -> bool { containsWord_regexp(s, pattern) }, _);
}

static L<Int> unix_killAll(final F1<S, Bool> f, O... _) {
  Map<Int, S> procs = psPidsAndCommands();
  Map<Int, S> p2 = filterMap(procs, (i, cmd) -> f.get(cmd));
  for (Int pid : keys(p2))
    print("Killing " + pid + ": " + p2.get(pid));
  unix_killProcesses(keys(p2), _);
  ret asList(keys(p2));
}

Author comment

Began life as a copy of #1009584

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1009587
Snippet name: unix_killAll - performs case-sensitive search in commands
Eternal ID of this version: #1009587/7
Text MD5: 5142e6343fcadbf409ec882554dd7117
Transpilation MD5: 00c26a6ac87813adb31e02537007a851
Author: stefan
Category: javax / unix
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-22 15:25:12
Source code size: 439 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 519 / 560
Version history: 6 change(s)
Referenced in: [show references]