1
0
mirror of https://github.com/gryf/fs-uae-wrapper.git synced 2025-12-19 04:20:23 +01:00

Added plain module - for running fs-uae directly

This commit is contained in:
2016-12-19 20:23:27 +01:00
parent b14a9f0156
commit acb056f112
2 changed files with 38 additions and 0 deletions

View File

38
fs_uae_wrapper/plain.py Normal file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simple class for executing fs-uae with specified parameters. This is a
failsafe class for running fs-uae.
"""
import subprocess
import sys
class Plain(object):
"""Class for run fs-uae"""
def run(self, conf, fs_uae_options):
"""
Run the emulation.
conf is a path to the configuration,
fs_uae_options is a list contains tokenized options to be passed to
fs-uae
"""
try:
subprocess.call(['fs-uae'] + [conf] + fs_uae_options)
except subprocess.CalledProcessError:
sys.stderr.write('Warning: fs-uae returned non 0 exit code\n')
def clean(self):
"""In this class, do nothing on exit"""
return
def run(config_file, fs_uae_options, _):
"""Run fs-uae with provided config file and options"""
runner = Plain()
try:
runner.run(config_file, fs_uae_options)
finally:
runner.clean()