From 5303d6294b5533f75a5e89953872e39bcc1f8c1f Mon Sep 17 00:00:00 2001 From: adam j hartz Date: Wed, 18 Mar 2015 19:43:23 -0400 Subject: [PATCH] compile scripts with exec mode instead of single --- xonsh/main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xonsh/main.py b/xonsh/main.py index 2a6bae0c7..b3cb91978 100644 --- a/xonsh/main.py +++ b/xonsh/main.py @@ -33,14 +33,14 @@ def main(argv=None): # run a script contained in a file if os.path.isfile(args.file): with open(args.file) as f: - for line in f: - shell.default(line) + code = shell.execer.compile(f.read(), mode='exec') + shell.execer.exec(code, mode='exec') else: print('xonsh: {0}: No such file or directory.'.format(args.file)) elif not sys.stdin.isatty(): # run a script given on stdin - for line in sys.stdin: - shell.default(line) + code = shell.execer.compile(sys.stdin.read(), mode='exec') + shell.execer.exec(code, mode='exec') else: # otherwise, enter the shell shell.cmdloop()