Skip to content

Instantly share code, notes, and snippets.

@patcon
Created June 28, 2012 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patcon/3014293 to your computer and use it in GitHub Desktop.
Save patcon/3014293 to your computer and use it in GitHub Desktop.
[SOLVED] Drush building from /dev/stdin doesn't work on some systems

Building from /dev/stdin work fine on Macbook (useful to use sed to edit stream).

➜  2ndleveldeep git:(develop) ✗ cat << EOH >> /tmp/test.make
heredoc> core = 7.x
heredoc> api = 2
heredoc> 
heredoc> projects[] = drupal
heredoc> EOH
➜  2ndleveldeep git:(develop) ✗ cat /tmp/test.make | drush make /dev/stdin /tmp/test
drupal-7.14 downloaded.
➜  2ndleveldeep git:(develop) ✗ php -v
PHP 5.3.8 (cli) (built: Dec  5 2011 21:24:09) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
➜  2ndleveldeep git:(develop) ✗ drush --version
drush version 5.3
➜  2ndleveldeep git:(develop) ✗ uname -a
Darwin Patrick-Connollys-MacBook-Pro.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64

But running on a Lucid64 vagrant box doesn't work (same for 5.0):

vagrant@lucid64:~$ cat << EOH >> /tmp/test.make
> core = 7.x
> api = 2
> 
> projects[] = drupal
> EOH
vagrant@lucid64:~$ cat /tmp/test.make | drush make /dev/stdin /tmp/test
file_get_contents(/dev/stdin): failed to open stream: No such file or directory
make.utilities.inc:449                                              [warning]
Invalid or empty make file: /dev/stdin                              [error]
vagrant@lucid64:~$ php -v
PHP 5.3.2-1ubuntu4.17 with Suhosin-Patch (cli) (built: Jun 19 2012 03:21:35) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
vagrant@lucid64:~$ drush --version
drush version 5.4
vagrant@lucid64:~$ uname -a
Linux lucid64 2.6.32-38-server #83-Ubuntu SMP Wed Jan 4 11:26:59 UTC 2012 x86_64 GNU/Linux
@patcon
Copy link
Author

patcon commented Jun 29, 2012

Ended up having NOTHING to do with PHP versions. Still not sure why it worked on 5.3.8 on Mac, but not the same version on lucid, but found an alternative:

cat /tmp/test.make | drush make php://stdin /tmp/test

This works since file_get_contents('php://stdin') doesn't fail like it does with /dev/stdin.

Reference: http://stackoverflow.com/questions/3249427/how-to-process-stdin-to-stdout-in-php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment