mirror of
https://github.com/YosysHQ/sby.git
synced 2025-08-15 01:15:30 +00:00
Try to remove database on -f
If the database is open (based on the presence of certain files), skip deletion. There is a (very) small window where another process *could* try to open the database at the same time that it's being deleted, but it will then fail during the database setup with `sqlite3.OperationalError: disk I/O error`, but given the failure is immediate I think it's fine.
This commit is contained in:
parent
dd008ec7f7
commit
baf118c838
2 changed files with 19 additions and 1 deletions
|
@ -22,7 +22,7 @@ import json, os, sys, shutil, tempfile, re
|
|||
from sby_cmdline import parser_func
|
||||
from sby_core import SbyConfig, SbyTask, SbyAbort, SbyTaskloop, process_filename, dress_message
|
||||
from sby_jobserver import SbyJobClient, process_jobserver_environment
|
||||
from sby_status import SbyStatusDb
|
||||
from sby_status import SbyStatusDb, remove_db, FileInUseError
|
||||
import time, platform, click
|
||||
|
||||
release_version = 'unknown SBY version'
|
||||
|
@ -464,6 +464,12 @@ def start_task(taskloop, taskname):
|
|||
print("*", file=gitignore)
|
||||
with open(f"{my_workdir}/status.path", "w") as status_path:
|
||||
print(my_status_db, file=status_path)
|
||||
if os.path.exists(f"{my_workdir}/{my_status_db}") and opt_force:
|
||||
try:
|
||||
remove_db(f"{my_workdir}/{my_status_db}")
|
||||
except FileInUseError:
|
||||
# don't delete an open database
|
||||
pass
|
||||
|
||||
junit_ts_name = os.path.basename(sbyfile[:-4]) if sbyfile is not None else workdir if workdir is not None else "stdin"
|
||||
junit_tc_name = taskname if taskname is not None else "default"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue