<commit_before><?php

namespace Nyx;

class Process implements ProcessInterface, OutputableInterface
{
    const PROCESS_STOPPED = 0;
    const PROCESS_RUNNING = 1;
    const PROCESS_SIGNALED = 2;

    /**
     * @var resource
     */
    protected $process;

    /**
     * @var CommandInterface
     */
    protected $command;

    /**
     * @var OutputInterface
     */
    protected $output;

    /**
     * Process constructor.
     *
     * @param CommandInterface $command
     */
    public function __construct(CommandInterface $command)
    {
        $this->command = $command;
    }

    /**
     * {@inheritdoc}
     */
    public function setCommand(CommandInterface $command)
    {
        $this->command = $command;
    }

    /**
     * {@inheritdoc}
     */
    public function getCommand()
    {
        return $this->command;
    }

    /**
     * {@inheritdoc}
     */
    public function open()
    {
        $command = $this->command->toString();
        $this->getOutput()->write("[+] New process with command: " . $command);

        // Command options
        $in  = array_values($this->command->getOption('in',  array('pipe', 'r')));
        $out = array_values($this->command->getOption('out', array('pipe', 'a')));
        $err = array_values($this->command->getOption('err', array('pipe', 'a')));

        $this->process = proc_open($command, array(
            0 => $in,
            1 => $out,
            2 => $err
        ), $pipes);
    }

    /**
     * {@inheritdoc}
     */
    public function close()
    {
        if(is_resource($this->process)) {
            proc_close($this->process);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function isRunning()<commit_msg>[BUG] write to /tmp/nyx*.log if configuration doesn't provide the option<commit_after><?php

namespace Nyx;

class Process implements ProcessInterface, OutputableInterface
{
    const PROCESS_STOPPED = 0;
    const PROCESS_RUNNING = 1;
    const PROCESS_SIGNALED = 2;

    /**
     * @var resource
     */
    protected $process;

    /**
     * @var CommandInterface
     */
    protected $command;

    /**
     * @var OutputInterface
     */
    protected $output;

    /**
     * Process constructor.
     *
     * @param CommandInterface $command
     */
    public function __construct(CommandInterface $command)
    {
        $this->command = $command;
    }

    /**
     * {@inheritdoc}
     */
    public function setCommand(CommandInterface $command)
    {
        $this->command = $command;
    }

    /**
     * {@inheritdoc}
     */
    public function getCommand()
    {
        return $this->command;
    }

    /**
     * {@inheritdoc}
     */
    public function open()
    {
        $command = $this->command->toString();
        $this->getOutput()->write("[+] New process with command: " . $command);

        // Command options
        $in  = array_values($this->command->getOption('in',  array('pipe', 'r')));
        $out = array_values($this->command->getOption('out', array('file', '/tmp/nyx.log', 'a')));
        $err = array_values($this->command->getOption('err', array('file', '/tmp/nyx-error.log', 'a')));

        $this->process = proc_open($command, array(
            0 => $in,
            1 => $out,
            2 => $err
        ), $pipes);
    }

    /**
     * {@inheritdoc}
     */
    public function close()
    {
        if(is_resource($this->process)) {
            proc_close($this->process);
        }
    }

    /**
     * {@inheritdoc}
     */
    public function isRunning()
{'fraction_non_alphanumeric': 0.15909732016925246, 'fraction_numerical': 0.003385049365303244, 'mean_word_length': 1.9698492462311559, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '7419146', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1045, 'n_words': 208}