jquery/testswarm

dead database.lock with scripts/dbInstall.php > install.log

Closed this issue · 1 comments

php scripts/dbInstall.php > install.log

[TestSwarm 1.0.0-alpha] Maintenance script

DBInstall: Install the TestSwarm database. Can also clear a database if it exists.
           ------------------------------------------------------------------------
Setting database.lock, other requests may not access the database during installation.
Database already contains tables. If you continue, all tables will be dropped. (Y/N)

TestSwarm Error: This script requires an interactive terminal for output and input

You can see there is no "Removed database.lock" line

The script seems to skip a step "2.1 remove database.lock" here

  1. set a database.lock
  2. call cliInput()
  3. exit(' requires an interactive terminal blah blah')

We'd have to implement some sort of exit-hook to clean up, however cliInput could be asked for halfway a maintenance script, so we don't want to remove the lock regardless of how and when we exited, only if it is done.

dbInstall.php only removes the lock for acceptable exit strategies. Any unexpected exit paths or exits by other classes (such as the case of "requires an interactive terminal") leave the lock in place, this is because in those cases it is likely a problem that you (the user) should address before continuing.

In this case, pass option --quiet which will skip any questions (automatically answering with ""). If you want to re-install and force-remove existing tables (as opposed to silently running the installer which will do nothing if it has already been installed), then pass --force as well.