make new VSC port pio script more failsafe (#23439)

* no crash when VSC database is not found
* don't stop when unknown OS is detected
This commit is contained in:
Jason2866 2025-05-18 15:41:10 +02:00 committed by GitHub
parent 2b460aa112
commit 54a9a117fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,8 +21,10 @@ if os.environ.get("PLATFORMIO_CALLER") == "vscode":
try:
db_path = os.path.expanduser(os.path.expandvars(os_paths[os_name]))
except KeyError:
raise RuntimeError("Unknown OS: " + os_name)
print("Unknown OS: " + os_name)
# Only when the database is found we can go on
if os.path.exists(db_path):
conn = sqlite3.connect(db_path)
cursor = conn.cursor()