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

18
LINES

< > BotCompany Repo | #1009616 // windows_killAll - see unix_killAll

JavaX fragment (include)

1  
static L<Int> windows_killAll(fS pattern, O... _) {
2  
  ret windows_killAll(cicAsFunction(pattern), _);
3  
}
4  
5  
static L<Int> windows_killAll(F1<S, Bool> f, O... _) {
6  
  if (!isWindows()) fail("No Windows");
7  
  new L<Int> pids;
8  
  for (OSProcess p : oshi_listProcesses()) {
9  
    S command = p.getCommandLine();
10  
    if (f.get(command)) {
11  
      int pid = p.getProcessID();
12  
      pids.add(pid);
13  
      print("Killing " + pid + ": " + command);
14  
    }
15  
  }
16  
  windows_killProcesses(pids);
17  
  ret pids;
18  
}

Author comment

Began life as a copy of #1009587

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009616
Snippet name: windows_killAll - see unix_killAll
Eternal ID of this version: #1009616/11
Text MD5: 5311b385b724fc31ba6d6aeac5d7f307
Author: stefan
Category: javax / windows
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-15 17:31:17
Source code size: 500 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 433 / 446
Version history: 10 change(s)
Referenced in: [show references]