Open scuben opened 8 years ago
Can't use the command_map because only the first argument of a execute statement gets resolved with the command_map
Why?
SSHKit.config.command_map[:php] = "php -d allow_url_fopen=Off"
should work.
require 'sshkit'
require 'sshkit/dsl'
include SSHKit::DSL
SSHKit.config.command_map[:php] = "php"
on 'localhost' do
puts capture :php, "-i | grep allow_url_fopen"
SSHKit.config.command_map[:php] = "php -d allow_url_fopen=Off"
puts capture :php, "-i | grep allow_url_fopen"
end
outputs:
allow_url_fopen => On => On
allow_url_fopen => Off => Off
@guillaumelecerf this does not reproduce the issue stated by @scuben. The issue is that the first argument is resolved with the command_map. The code to install composer states:
execute :curl, "-s", fetch(:composer_download_url), "|", :php, composer_version_option
So only :curl
gets mapped and :php
does not, so overriding :php
in the command_map has zero effect on the execute that pipes it to :php
.
As example:
require 'sshkit'
require 'sshkit/dsl'
include SSHKit::DSL
SSHKit.config.command_map[:php] = "php -d allow_url_fopen=Off"
on 'localhost' do
puts capture :php, '-i | grep allow_url_fopen'
puts capture :echo, '""', '|', :php, '-i | grep allow_url_fopen'
end
outputs:
allow_url_fopen => Off => Off
allow_url_fopen => On => On
On the Task
composer:install_executable
which executesI need to change the php binary including its arguments.
The default commend which is being executed looks like this:
curl -s https://getcomposer.org/installer | php
What I need is:
curl -s https://getcomposer.org/installer | php56 -d allow_url_fopen=On
What I already know does not work:
The only viable solution I see is the change the lib code
:php
tofetch(:php)
(or similar) to be able to define the php binary (with its argument) withset :php, 'php -d allow_url_fopen=On'
. Is this true or am I missing something?