<commit_before># File: ProcessManager.pm
# Author: pragma_
#
# Purpose: Handles forking and execution of module/subroutine processes

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

package PBot::ProcessManager;

use parent 'PBot::Class';

use warnings; use strict;
use feature 'unicode_strings';

use Time::Duration qw/concise duration/;
use Time::HiRes qw/gettimeofday/;
use Getopt::Long qw/GetOptionsFromArray/;
use POSIX qw/WNOHANG/;
use JSON;

sub initialize {
    my ($self, %conf) = @_;
    $self->{pbot}->{commands}->register(sub { $self->ps_cmd(@_) },   'ps',   0);
    $self->{pbot}->{commands}->register(sub { $self->kill_cmd(@_) }, 'kill', 1);
    $self->{pbot}->{capabilities}->add('admin', 'can-kill');
    $self->{processes} = {};<commit_msg>ProcessManager: properly add "can-kill" cap without triggering saving<commit_after># File: ProcessManager.pm
# Author: pragma_
#
# Purpose: Handles forking and execution of module/subroutine processes

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

package PBot::ProcessManager;

use parent 'PBot::Class';

use warnings; use strict;
use feature 'unicode_strings';

use Time::Duration qw/concise duration/;
use Time::HiRes qw/gettimeofday/;
use Getopt::Long qw/GetOptionsFromArray/;
use POSIX qw/WNOHANG/;
use JSON;

sub initialize {
    my ($self, %conf) = @_;
    $self->{pbot}->{commands}->register(sub { $self->ps_cmd(@_) },   'ps',   0);
    $self->{pbot}->{commands}->register(sub { $self->kill_cmd(@_) }, 'kill', 1);
    $self->{pbot}->{capabilities}->add('admin', 'can-kill', 1);
    $self->{processes} = {};
{'fraction_non_alphanumeric': 0.1635588705380927, 'fraction_numerical': 0.006925945657964837, 'mean_word_length': 4.427745664739884, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '732174', 'n_tokens_mistral': 662, 'n_tokens_neox': 643, 'n_words': 188}