Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closure on Windows - not recognized command #60

Closed
RyanNutt opened this issue Jul 21, 2017 · 2 comments
Closed

Closure on Windows - not recognized command #60

RyanNutt opened this issue Jul 21, 2017 · 2 comments

Comments

@RyanNutt
Copy link

I'm getting an error when trying to test my first task from the Windows command line. I'm still working on getting my head wrapped around Crunz, so this may very well be a silly mistake on my part.

Here's my task code.

use Crunz\Schedule;

$schedule = new Schedule();

$schedule->run( function() {
                echo 'Howdy'; 
        } )
        ->description( 'Test task' )
        ->everyMinute();

return $schedule;

The error I'm getting is

crunz.ERROR: 'c:\path\to\vendor\lavary\crunz\src/../crunz' is not recognized as an internal or external commad, operable program or batch file

It only does this when I'm trying to use a closure. If I enter a command like dir it works perfectly.

schedule:list works and shows object(Closure) as the task to run.

I've tried running the crunz.bat file from the folder it's in and also from the project root with the path in front. I've also tried running php crunz schedule:run from within the lavary/crunz folder, and that didn't work either.

@knutle
Copy link

knutle commented Dec 20, 2017

i also ran into this issue.
looks like a bug in lavary\crunz\src\Event.php:249 where it expects the file lavary\crunz\crunz to be executable by itself. prepending php to the command seems to fix this issue. resulting line 249:
return "php " . __DIR__ . '/../crunz closure:run ' . http_build_query([$closure]);

@PabloKowalczyk
Copy link
Collaborator

Thanks for report. Fixed in #86.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants