Node Manager Pm2

PHP

Plesk extension for managing PM2-powered Node.js applications with process control, monitoring, deployment automation, and seamless server integration.

Stars
16
Forks
2
Downloads
N/A
Open Issues
0
Files main

Repository Files

Loading file structure...
plib/library/NodeManagerPm2/CommandResult.php
<?php
class Modules_NodeManagerPm2_CommandResult
{
    public $code;
    public $stdout;
    public $stderr;
    public $command;

    public function __construct($code, $stdout, $stderr, $command)
    {
        $this->code = (int) $code;
        $this->stdout = (string) $stdout;
        $this->stderr = (string) $stderr;
        $this->command = (string) $command;
    }

    public function assertOk($message)
    {
        if ($this->code !== 0) {
            $details = trim($this->stderr) ?: trim($this->stdout);
            throw new Modules_NodeManagerPm2_Exception($message . ($details ? ': ' . $details : ''));
        }

        return $this;
    }
}