Lullabot / drainpipe

GNU General Public License v3.0
34 stars 14 forks source link

Fix upgrading task in task #679

Closed deviantintegral closed 2 months ago

deviantintegral commented 2 months ago

This will fix this error when upgrading task originally reported at https://github.com/Lullabot/drainpipe/issues/164

[drupal:composer:development] 🪠 [Drainpipe] vendor/lullabot/drainpipe/scaffold/env/dotenv.php' missing from autoload-dev files
[drupal:composer:development] 🪠 [Drainpipe] vendor/lullabot/drainpipe/scaffold/env/dotenv.php' missing from autoload-dev files
[drupal:composer:development] Using cached version of task v3.38.0 (30d3c727a434ee3bf69fb69e5d1aa84c3ab401fc2343a2760b4c7808acc689b8)
[drupal:composer:development]
[drupal:composer:development] In Filesystem.php line 372:
[drupal:composer:development]
[drupal:composer:development]   copy(/var/www/html/vendor/bin/task): Failed to open stream: Text file busy
[drupal:composer:development]
[drupal:composer:development]

https://github.com/Lullabot/drainpipe/blob/c293ed779f1bcacf64390daa567258f422b582f2/src/BinaryInstaller.php#L253

We need to add a remove() call before the copy, so the task binary can be replaced if it is still in use by a process.

Here's a test that should hopefully fail and reproduce this issue: https://github.com/Lullabot/drainpipe/actions/runs/10692591483/job/29641292997

image
justafish commented 2 months ago

nice one :+1: