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

Shebang scripts not working #2876

Closed
weitzman opened this issue Aug 14, 2017 · 5 comments
Closed

Shebang scripts not working #2876

weitzman opened this issue Aug 14, 2017 · 5 comments

Comments

@weitzman
Copy link
Member

I cant get shebang scripts to work. I'm ok with dropping this feature. If anyone wants to debug, we ship with one. this should run it - ./drush --script-path=./examples php-script helloworld.script

@greg-1-anderson
Copy link
Member

Shebang scripts run like bash scripts:

$ ./examples/helloworld.script foo
Hello world!

The arguments to this command were:
  foo

No bootstrapped site.

@greg-1-anderson
Copy link
Member

Shebang scripts are supported by Robo, so it shouldn't be any trouble to continue to support them in #2843.

@weitzman
Copy link
Member Author

Yes of course!

However, its still not working for me. Note that drush points to my launcher so I have to pass -r. For some reason Drush is not bootstrapping properly. And its not recognizing the shebang. Will debug later.

drush/examples/helloworld.script -r /Users/moshe.weitzman/reps/b4 --debug

[error]  The Drush command 'drush/examples/helloworld.script' could not be found. Use 'drush core-status' to verify that Drupal is found and bootstrapped successfully. Look for 'Drupal bootstrap : Successful' in its output. [0.88 sec, 22.49 MB] 

@greg-1-anderson
Copy link
Member

greg-1-anderson commented Aug 14, 2017

Sounds like the launcher is not passing through the original working directory; I am guessing that Drush 8 behaves the same way. I'm not sure if there are other commands that use this; pm-download is the only one I can think of off the top of my head, and it only needs it when there is no bootstrapped site.

It works if you bootstrap via the cwd rather than via -r:

$ ~/local/drupal/drush9/drush/examples/helloworld.script foo
Hello world!

The arguments to this command were:
  foo

The following site is bootstrapped:
$aliases['default'] = array (
  'root' => '/Users/ganderson/local/drupal/sites/couture-costume',
  'uri' => 'http://default',
);

This could just be documented as a limitation of shebang scripts; ideally, though, the launcher would pass through the original cwd, just in case it was needed.

(Note - I haven't looked into this later; it could be that the original cwd is lost at some other point.)

@weitzman
Copy link
Member Author

We decided to deprecate shebang scripts.

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

2 participants