{"action":"opened","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/15706","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/15706/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/15706/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/15706/events","html_url":"https://github.com/laravel/framework/issues/15706","id":180499082,"number":15706,"title":"crontab can run tasks concurrently and get the fail message ","user":{"login":"uppinggoer","id":19359850,"avatar_url":"https://avatars.githubusercontent.com/u/19359850?v=3","gravatar_id":"","url":"https://api.github.com/users/uppinggoer","html_url":"https://github.com/uppinggoer","followers_url":"https://api.github.com/users/uppinggoer/followers","following_url":"https://api.github.com/users/uppinggoer/following{/other_user}","gists_url":"https://api.github.com/users/uppinggoer/gists{/gist_id}","starred_url":"https://api.github.com/users/uppinggoer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uppinggoer/subscriptions","organizations_url":"https://api.github.com/users/uppinggoer/orgs","repos_url":"https://api.github.com/users/uppinggoer/repos","events_url":"https://api.github.com/users/uppinggoer/events{/privacy}","received_events_url":"https://api.github.com/users/uppinggoer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-02T07:00:10Z","updated_at":"2016-10-02T07:00:10Z","closed_at":null,"body":"- Laravel Version: 5.1.*  & 5.3.*\r\n- PHP Version:\r\n- Database Driver & Version:\r\n\r\n### Description:\r\n\r\nwhen i use the laravel's crontab, my script appears OOM and exit 255. i can't get any alert. Then i try to use emailOutputTo to get that error, i found that if my script sleep some seconds, the \bfollowing scripts would not run.\r\n```\r\n// Illuminate/Console/Scheduling/Event.php\r\nprotected function runCommandInForeground(Container $container)\r\n{\r\n// these code will serialize the all then events\r\n(new Process(\r\ntrim($this->buildCommand(), '& '), base_path(), null, null, null\r\n))->run(); // and run() while call wait() force all tasks run serially\r\n\r\n$this->callAfterCallbacks($container);\r\n}\r\n```\r\n\r\nIf some while(true) or sleep in my scripts, all the next tasks will not run\r\nSo, I want add runAsyn() to run all the tasks concurrently.\r\n```\r\n// Console/Scheduling/ScheduleRunCommand.php\r\npublic function fire()\r\n{\r\n    $events = $this->schedule->dueEvents($this->laravel);\r\n\r\n    foreach ($events as $event)\r\n    {\r\n        $this->line('<info>Running scheduled command:</info> '.$event->getSummaryForDisplay());\r\n\r\n        $event->runAsyc($this->laravel);\r\n    }\r\n\r\n    $runNum = count($events);\r\n    do {\r\n        sleep(10);\r\n        foreach ($events as $event)\r\n        {\r\n            if ($event->cleanUp($this->laravel)) \r\n            {\r\n                -- $runNum;\r\n            }\r\n        }\r\n    } while (0 < $runNum);\r\n\r\n    if (count($events) === 0)\r\n    {\r\n        $this->info('No scheduled commands are ready to run.');\r\n    }\r\n}\r\n\r\n// use the new do{}while to do all the cleanup\r\n```\r\nthen the cleanup function\r\n```\r\n// Illuminate/Console/Scheduling/Event.php\r\npublic function cleanUp(Container $container)\r\n{\r\n    if (isset($this->process))\r\n    {\r\n        if ($this->process->isTerminated()) {\r\n            $intExitCode = $this->process->getExitCode();\r\n\r\n            // callback after finish\r\n            $this->callAfterCallbacks($container, $intExitCode);\r\n        }\r\n    }\r\n    else\r\n    {\r\n        return true;\r\n    }\r\n}\r\n\r\nprotected function callAfterCallbacks(Container $container, int $intExitCode=0)\r\n{\r\n    foreach ($this->afterCallbacks as $callback)\r\n    {\r\n        $container->call($callback);\r\n    }\r\n    if (0 < $intExitCode) {\r\n        foreach ($this->failAfterCallbacks as $callback)\r\n        {\r\n            $container->call($callback);\r\n        }\r\n    }\r\n}\r\n```\r\nso i will get all the alert\r\n```\r\n$schedule->command('script')->cron(\"* * * * * *\")\r\n    ->sendOutputTo(\"/tmp/alert.txt\")\r\n    ->failEmailOutputTo(\"uppinggoer@gmail.com\");\r\n```\r\n\r\n### Steps To Reproduce:\r\n"}}
{"actor":{"display_login":"uppinggoer"}}