porozhnyy / laravel-roadrunner

Simple Laravel-Roadrunner bridge
MIT License
47 stars 5 forks source link

Script in vendor/bin not working when bin-compat full is enabled #3

Open sergix44 opened 4 years ago

sergix44 commented 4 years ago

When running Roadrunner under windows, or when configured in the composer.json the option "bin-compat": "full" to support all script variants, the link to the starter script in vendor/bin/roadrunner-worker cannot be used:

$ php vendor/bin/roadrunner-worker

dir=$(cd "${0%[/\\]*}" > /dev/null; cd '../hunternnm/laravel-roadrunner/bin' && pwd)

if [ -d /proc/cygdrive ] && [[ $(which php) == $(readlink -n /proc/cygdrive)/* ]]; then
   # We are in Cgywin using Windows php, so the path must be translated
   dir=$(cygpath -m "$dir");
fi

"${dir}/roadrunner-worker" "$@"

And when you try to invoke the script via bash:

$ bash vendor/bin/roadrunner-worker
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 1: ?php: No such file or directory
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 3: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 4: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 5: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 6: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 7: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 8: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 9: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 10: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 11: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 12: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 13: use: command not found
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 15: syntax error near unexpected token `'display_errors','
<PATHTO>/vendor/hunternnm/laravel-roadrunner/bin/roadrunner-worker: line 15: `ini_set('display_errors', 'stderr');'

(Double checked execution permission, etc) If you add a shebang (#!/usr/bin/env php) in the roadrunner-worker file, the problem should be fixed, and the second command should work.

porozhnyy commented 4 years ago

shebang added, pls check in v2.0.3

sergix44 commented 4 years ago

Invoking the worker via bash now starts the worker without issues (bash vendor/bin/roadrunner-worker), but, when feeding the command in the .rr.yaml file, when launching roadrunner it hangs and doesn't start at all and simply frezees without errors. I can't tell if is a problem of roadrunner or a configuration issue.