{"action":"closed","issue":{"url":"https://api.github.com/repos/reisraff/phulp/issues/46","repository_url":"https://api.github.com/repos/reisraff/phulp","labels_url":"https://api.github.com/repos/reisraff/phulp/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/reisraff/phulp/issues/46/comments","events_url":"https://api.github.com/repos/reisraff/phulp/issues/46/events","html_url":"https://github.com/reisraff/phulp/issues/46","id":343158635,"node_id":"MDU6SXNzdWUzNDMxNTg2MzU=","number":46,"title":"[PROPOSAL] - Upgrade phulp::exec","user":{"login":"reisraff","id":4624214,"node_id":"MDQ6VXNlcjQ2MjQyMTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/4624214?v=4","gravatar_id":"","url":"https://api.github.com/users/reisraff","html_url":"https://github.com/reisraff","followers_url":"https://api.github.com/users/reisraff/followers","following_url":"https://api.github.com/users/reisraff/following{/other_user}","gists_url":"https://api.github.com/users/reisraff/gists{/gist_id}","starred_url":"https://api.github.com/users/reisraff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reisraff/subscriptions","organizations_url":"https://api.github.com/users/reisraff/orgs","repos_url":"https://api.github.com/users/reisraff/repos","events_url":"https://api.github.com/users/reisraff/events{/privacy}","received_events_url":"https://api.github.com/users/reisraff/received_events","type":"User","site_admin":false},"labels":[{"id":1079584935,"node_id":"MDU6TGFiZWwxMDc5NTg0OTM1","url":"https://api.github.com/repos/reisraff/phulp/labels/Hacktoberfest","name":"Hacktoberfest","color":"ffd84f","default":false},{"id":377861643,"node_id":"MDU6TGFiZWwzNzc4NjE2NDM=","url":"https://api.github.com/repos/reisraff/phulp/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":377861644,"node_id":"MDU6TGFiZWwzNzc4NjE2NDQ=","url":"https://api.github.com/repos/reisraff/phulp/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true},{"id":963990369,"node_id":"MDU6TGFiZWw5NjM5OTAzNjk=","url":"https://api.github.com/repos/reisraff/phulp/labels/proposal","name":"proposal","color":"90b1f4","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-20T15:50:29Z","updated_at":"2018-10-18T19:02:15Z","closed_at":"2018-10-18T19:02:15Z","author_association":"OWNER","body":"```php\r\n<?php\r\n\r\nuse Phulp\\Output as out;\r\n\r\n$phulp->task('async-command', function ($phulp) {\r\n    $onStdOut = function ($tick, $stdIn) {\r\n        // $tick @var string\r\n        // $stdIn @var object stream\r\n\r\n        // out::out($tick);\r\n\r\n        if (-1 !== strpos($tick, 'Do you really want to do this? [y/n]')) {\r\n            $stdIn->write('y' . PHP_EOL);\r\n    };\r\n    $onStdErr = function ($tick, $stdIn) {\r\n        // $tick @var string\r\n        // $stdIn @var object stream\r\n\r\n        // out::err($tick);\r\n\r\n        if (-1 !== strpos($tick, 'Write all output on file? [y/n]')) {\r\n            $stdIn->write('y' . PHP_EOL);\r\n        }\r\n    };\r\n    $onFinish = function ($sigInt, $stdOut, $stdErr) {\r\n        // $sigInt @var int\r\n        // $stdOut @var string\r\n        // $stdErr @var string\r\n        return;\r\n    };\r\n\r\n    // $result @var boolean\r\n    $result = $phulp->exec(\r\n        'ls -lah', // command\r\n        [\r\n            'cwd' => '/var/log', // default getcwd()\r\n\r\n            // ENV vars, default = []\r\n            'env' => [\r\n                'ENVIRONMENT' => 'PROD'\r\n            ],\r\n\r\n            'quiet' => true // default=false, write stdout, and stderr by itselt\r\n            'sync' => false // default=true\r\n            'onStdOut' => $onStdOut, // handle tick\r\n            'onStdErr' => $onStdErr, // handle tick\r\n            'onFinish' => $onFinish, // handle sigInt, stdout, stderr\r\n        ]\r\n    );\r\n});\r\n\r\n$phulp->task('sync-command', function ($phulp) {\r\n    $result = $phulp->exec('ls -lah');\r\n\r\n    $sigInt = $result->getSigInt(); // $sigInt @var int\r\n    $stdOut = $result->getStdOut(); // $stdOut @var string\r\n    $stdErr = $result->getStdErr(); // $stdErr @var string\r\n});\r\n\r\n```"}}
{"actor":{"display_login":"reisraff"}}