1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 10:16:14 +01:00

Merge pull request #1330 from dmach/fix-AppImage-OWD

Fix running osc in an AppImage by switching to the correct working directory
This commit is contained in:
Daniel Mach 2023-05-23 16:00:39 +02:00 committed by GitHub
commit 2bd9142373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,6 +226,13 @@ def main():
sys.stdout = os.fdopen(sys.stdout.fileno(), sys.stdout.mode, 1) sys.stdout = os.fdopen(sys.stdout.fileno(), sys.stdout.mode, 1)
sys.stderr = os.fdopen(sys.stderr.fileno(), sys.stderr.mode, 1) sys.stderr = os.fdopen(sys.stderr.fileno(), sys.stderr.mode, 1)
appimage = os.getenv("APPIMAGE", None)
owd = os.getenv("OWD", None)
if appimage and owd:
# OWD stands for Original Working Directory and we need to switch there when running in an AppImage
# https://docs.appimage.org/packaging-guide/environment-variables.html
os.chdir(owd)
sys.exit(run(commandline.OscMainCommand())) sys.exit(run(commandline.OscMainCommand()))
# vim: sw=4 et # vim: sw=4 et