Skip to content

Commit d2f925c

Browse files
committed
Inspect exit code when testing if running
1 parent 9b28910 commit d2f925c

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,19 @@ jobs:
4747
python build.py --ci --no-deps --no-tests --no-install
4848
4949
- name: Test build
50+
id: test
5051
run: |
5152
.venv\Scripts\Activate.ps1
5253
python build.py --ci --no-deps --no-build --no-install
5354
55+
- name: Save
56+
if: failure() && steps.test.outcome == 'failure'
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: failed-build
60+
path: |
61+
dist/Music Caster Setup.exe
62+
5463
# upload the build continuously to avoid duplicate build on a tag
5564
# script will exit with zero if release for VERSION exists since --ci is used
5665
- name: Upload build

build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,13 @@ def upgrade_yt_dlp():
609609
f'"{DIST_DIR}/Music Caster OneDir/Music Caster" -m --debug',
610610
shell=True)
611611
time.sleep(5)
612+
if p.returncode is not None:
613+
print('got return code', p.returncode)
614+
test(
615+
'No return code',
616+
lambda: p.returncode is None,
617+
True,
618+
)
612619
test(
613620
'Music Caster Should Be Running',
614621
lambda: is_already_running(threshold=1),

src/music_caster.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ def activate_instance(port=2001, default_timeout=0.5, to_port=2004):
297297
print('not moving database because file already exists')
298298
else:
299299
os.rename(DatabaseConnection.OLD_DATABASE_FILE, DatabaseConnection.DATABASE_FILE)
300+
try:
301+
with DatabaseConnection() as conn:
302+
pass
303+
except Exception:
304+
sys.exit(67)
300305

301306
# 0.5 seconds gone to 3rd party imports
302307
from flask import Flask, jsonify, render_template, request, redirect, send_file, Response, make_response

0 commit comments

Comments
 (0)