File tree Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Expand file tree Collapse file tree 3 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -165,8 +165,9 @@ private function exec(array $commands)
165
165
if (is_array ($ command )) {
166
166
$ this ->exec ($ command );
167
167
} else {
168
- if ($ key === 'php ' ) {
169
- $ command = $ this ->php () . ' ' . $ command ;
168
+ if (is_string ($ key )) {
169
+ $ this ->extendEnvironmentPath ($ key );
170
+ $ command = $ key . ' ' . $ command ;
170
171
}
171
172
$ this ->logDated ('$ ' . $ command );
172
173
exec ($ command . ' 2>&1 ' , $ response , $ error_code );
@@ -179,6 +180,26 @@ private function exec(array $commands)
179
180
}
180
181
}
181
182
183
+ private function extendEnvironmentPath ($ command )
184
+ {
185
+ $ extPath = '' ;
186
+ if ($ command === 'php ' ) {
187
+ $ extPath = ': ' . dirname ($ this ->php ());
188
+ } else {
189
+ exec ('dirname $(whereis ' . $ command . ') 2>&1 ' , $ response , $ error_code );
190
+ if (is_array ($ response )) {
191
+ foreach (array_unique ($ response ) as $ path ) {
192
+ if ($ path !== '. ' ) {
193
+ $ extPath .= ': ' . $ path ;
194
+ }
195
+ }
196
+ }
197
+ }
198
+ if (!empty ($ extPath )) {
199
+ putenv ('PATH= ' . getenv ('PATH ' ) . $ extPath );
200
+ }
201
+ }
202
+
182
203
private function logDated ($ message )
183
204
{
184
205
if ($ this ->isFirstLogging ) {
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " optimistex/git-auto-deploy-ex" ,
3
- "version" : " 1.3.2 " ,
3
+ "version" : " 1.3.3 " ,
4
4
"type" : " library" ,
5
5
"description" : " The little project for auto-deploying projects to a hosting" ,
6
6
"keywords" : [
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " git-auto-deploy-ex" ,
3
- "version" : " 1.3.2 " ,
3
+ "version" : " 1.3.3 " ,
4
4
"description" : " The little project for auto-deploying projects to a hosting" ,
5
5
"main" : " index.js" ,
6
6
"directories" : {
You can’t perform that action at this time.
0 commit comments