fix issue where saving config is not executed
This commit is contained in:
parent
9d4ccd92ad
commit
be9e6c3d31
1 changed files with 9 additions and 4 deletions
13
minitch.py
13
minitch.py
|
@ -2,6 +2,7 @@
|
|||
import os
|
||||
import subprocess
|
||||
import argparse
|
||||
import atexit
|
||||
from shutil import unpack_archive
|
||||
import yaml
|
||||
import mergedeep
|
||||
|
@ -110,7 +111,10 @@ def parser_run(args):
|
|||
os.chdir(config['games'][args.game_id]['path'])
|
||||
os.chmod(config['games'][args.game_id]['executable'], 755)
|
||||
game_args = config['games'][args.game_id]['args'] if 'args' in config['games'][args.game_id] else []
|
||||
subprocess.run([config['games'][args.game_id]['executable'], *game_args])
|
||||
try:
|
||||
subprocess.run([config['games'][args.game_id]['executable'], *game_args])
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
def parser_list(args):
|
||||
global config
|
||||
|
@ -120,6 +124,9 @@ def parser_list(args):
|
|||
def main():
|
||||
read_config()
|
||||
|
||||
# Write config on exit
|
||||
atexit.register(write_config)
|
||||
|
||||
parser = argparse.ArgumentParser(description='Tiny little itch.io client')
|
||||
subparsers = parser.add_subparsers(title='subcommands', description='valid subcommands', help='additional help')
|
||||
|
||||
|
@ -163,7 +170,5 @@ def main():
|
|||
except AttributeError:
|
||||
parser.error('too few arguments')
|
||||
|
||||
write_config()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue