drainpipe
drainpipe copied to clipboard
Installing task binary: "text file busy"
The condition below avoids "text file busy" error partially.
If the hash_file result is different (if the task binaries are different), we could be running task
and still try to replace the task
binary.
On Tugboat, a preview already had the task binary and I got the "text file busy" error.
To fix it, I ran, before running task commands, composer install
and that installed the correct task version.
It is a very particular issue, and I would like to know if it is a drainpipe code or a drainpipe documentation issue... or not Drainpipe's issue at all.
It failed when running ./vendor/bin/task drupal:composer:development
https://github.com/Lullabot/drainpipe/blob/main/src/BinaryInstaller.php#L249
// Check the vendor/bin directory first, otherwise we could hit a
// condition where task has called "composer install --no-dev" after
// "composer install" and tries to replace the task binary - this will
// fail because the binary is already being run and you'll get a "failed
// to open stream: Text file busy" error.
if (file_exists($binDestination) && hash_file('sha256', $binDestination) === hash_file('sha256', $cacheExtractedBinary)) {
$this->io->write(sprintf('%s v%s (%s) already exists in bin-dir, not overwriting.', $binary, $version, $sha));
}