Skip to content

Commit

Permalink
Fix test function (#3717)
Browse files Browse the repository at this point in the history
Prevents line breaks that might be outputed in `run` return to break condition.
  • Loading branch information
nlemoine authored Oct 27, 2023
1 parent 6611816 commit 6ce69c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ function runLocally(string $command, ?array $options = [], ?int $timeout = null,
function test(string $command): bool
{
$true = '+' . array_rand(array_flip(['accurate', 'appropriate', 'correct', 'legitimate', 'precise', 'right', 'true', 'yes', 'indeed']));
return run("if $command; then echo $true; fi") === $true;
return trim(run("if $command; then echo $true; fi")) === $true;
}

/**
Expand Down Expand Up @@ -558,8 +558,8 @@ function invoke(string $taskName): void
/**
* Upload files or directories to host.
*
* > To upload the _contents_ of a directory, include a trailing slash (eg `upload('build/', '{{release_path}}/public');`).
* > Without the trailing slash, the build directory itself will be uploaded (resulting in `{{release_path}}/public/build`).
* > To upload the _contents_ of a directory, include a trailing slash (eg `upload('build/', '{{release_path}}/public');`).
* > Without the trailing slash, the build directory itself will be uploaded (resulting in `{{release_path}}/public/build`).
*
* The `$config` array supports the following keys:
*
Expand All @@ -569,7 +569,7 @@ function invoke(string $taskName): void
* - `progress_bar` to display upload/download progress
* - `display_stats` to display rsync set of statistics
*
* Note: due to the way php escapes command line arguments, list-notation for the rsync `--exclude={'file','anotherfile'}` option will not work.
* Note: due to the way php escapes command line arguments, list-notation for the rsync `--exclude={'file','anotherfile'}` option will not work.
* A workaround is to add a separate `--exclude=file` argument for each exclude to `options` (also, _do not_ wrap the filename/filter in quotes).
* An alternative might be to write the excludes to a temporary file (one per line) and use `--exclude-from=temporary_file` argument instead.
*
Expand Down

0 comments on commit 6ce69c5

Please sign in to comment.