diff options
| -rw-r--r-- | src/etoolkit/__main__.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/etoolkit/__main__.py b/src/etoolkit/__main__.py index 299d75c..a200453 100644 --- a/src/etoolkit/__main__.py +++ b/src/etoolkit/__main__.py | |||
| @@ -28,6 +28,7 @@ import io | |||
| 28 | import json | 28 | import json |
| 29 | import logging | 29 | import logging |
| 30 | import os | 30 | import os |
| 31 | import subprocess | ||
| 31 | import sys | 32 | import sys |
| 32 | 33 | ||
| 33 | import etoolkit | 34 | import etoolkit |
| @@ -324,9 +325,9 @@ def main(inargs=None): | |||
| 324 | os.environ.update(env) | 325 | os.environ.update(env) |
| 325 | 326 | ||
| 326 | if args.spawn: | 327 | if args.spawn: |
| 327 | os.system(args.spawn) | 328 | subprocess.run(args.spawn.split(), check=True) |
| 328 | else: | 329 | else: |
| 329 | os.system(os.getenv('SHELL', 'bash')) | 330 | subprocess.run(os.environ.get('SHELL', 'bash').split(), check=True) |
| 330 | except KeyboardInterrupt: | 331 | except KeyboardInterrupt: |
| 331 | logger.debug('KeyboardInterrupt') | 332 | logger.debug('KeyboardInterrupt') |
| 332 | print(os.linesep) | 333 | print(os.linesep) |
| @@ -334,6 +335,9 @@ def main(inargs=None): | |||
| 334 | except etoolkit.EtoolkitInstanceError as e: | 335 | except etoolkit.EtoolkitInstanceError as e: |
| 335 | logger.error('EtoolkitInstanceError: %s', e) | 336 | logger.error('EtoolkitInstanceError: %s', e) |
| 336 | sys.exit(1) | 337 | sys.exit(1) |
| 338 | except subprocess.CalledProcessError as e: | ||
| 339 | logger.error('Unable to spawn shell process: %s', e) | ||
| 340 | sys.exit(1) | ||
| 337 | except Exception as e: | 341 | except Exception as e: |
| 338 | logger.error('Unexpected exception: %s', e) | 342 | logger.error('Unexpected exception: %s', e) |
| 339 | sys.exit(1) | 343 | sys.exit(1) |
