Esempio n. 1
0
 public function testCanGetReturnValue()
 {
     $shell = new System();
     $shell->run(new Command('ls 1>/dev/null'));
     $this->assertEquals(ExitCodes::SUCCESS, $shell->getReturnValue(), 'The return should be a success');
     $this->assertInternalType('integer', $shell->getReturnValue(), 'The should be a return value');
     $shell->run(new Command('/dev/null 2>/dev/null'));
     $this->assertEquals(ExitCodes::PERMISSION_ERROR, $shell->getReturnValue(), 'The return should be an error');
 }
Esempio n. 2
0
 * @Author: Griffen Fargo
 * @Date:   2016-01-26 00:20:13
 * @Last Modified by:   Griffen Fargo
 * @Last Modified time: 2016-04-11 19:30:09
 */
// Load Composer Plugins
require 'vendor/autoload.php';
use AdamBrett\ShellWrapper\Command;
use AdamBrett\ShellWrapper\Command\Param;
use AdamBrett\ShellWrapper\Runners\Exec;
use AdamBrett\ShellWrapper\Runners\ShellExec;
use AdamBrett\ShellWrapper\Runners\System;
use AdamBrett\ShellWrapper\Runners\ReturnValue;
use AdamBrett\ShellWrapper\Command\Builder as CommandBuilder;
$shell = new ShellExec();
$system = new System();
$cmd = $_POST['command'];
// XDebug Stuff
if ($cmd == 'xdebug') {
    $xdebugCommand = new Command($cmd);
    // $debugCheck = new CommandBuilder('php');
    // $debugCheck->addFlag('m')
    //         ->addFlag('c |')
    //         // ->addArgument('|')
    //         ->addArgument('grep xdebug');
    //         // ->addArgument('xdebug');
    $debugCheck = new Command('php -m -c | grep xdebug');
    $check = $system->run($debugCheck);
    echo "current check: " . $check;
    $inipath = php_ini_loaded_file();
    if ($inipath) {