deployer icon indicating copy to clipboard operation
deployer copied to clipboard

Old releases are not deleted if colors is enabled for ls command

Open ocean90 opened this issue 1 year ago • 3 comments

  • Deployer version: 7.1.3
  • Deployment OS: macOS

I noticed that for a project the old releases were not deleted while keep_releases was set to 3. After some debugging I finally noticed that on the server we had ls aliased to ls --color=always. Because of this the array_map() in https://github.com/deployphp/deployer/blob/1bc90e84426059feb3a390283db6f2790e35d5a1/recipe/deploy/release.php#L39-L43 is producing an array with empty values:

array(32) {
  [0]=>
  string(4) ""
  [1]=>
  string(4) ""
  [2]=>
  string(4) ""
  [3]=>
  string(4) ""
  [4]=>

Before array_map() the output of $ll looks like:

Bildschirm­foto 2023-01-30 um 17 17 14

As you can see the folder name is in color.

The current fix would be to remove the alias but I'm wondering if Deployer should prevent the colors by explicitly passing --color=none to ls?

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar

ocean90 avatar Jan 30 '23 16:01 ocean90