diff options
author | kmvanbrunt <kmvanbrunt@gmail.com> | 2019-02-21 21:00:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 21:00:01 -0500 |
commit | bb376455b46e2fceba21120eba976465ea8d2c5a (patch) | |
tree | d4dda51dc5ddbd1c691a79b7adb3ad489d6f6db5 /cmd2/cmd2.py | |
parent | 086d4db5e10b9bfe64c767a2dad9c38fe95f299c (diff) | |
parent | befeaafa59acd86fd5b467dc459e8df131bf03eb (diff) | |
download | cmd2-git-bb376455b46e2fceba21120eba976465ea8d2c5a.tar.gz |
Merge pull request #628 from python-cmd2/simplify_edit
Removed os.system in favor of do_shell
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 65435d6b..d6da8b2b 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -3248,7 +3248,7 @@ class Cmd(cmd.Cmd): for command in history: fobj.write('{}\n'.format(command)) try: - os.system('"{}" "{}"'.format(self.editor, fname)) + self.do_edit(fname) self.do_load(fname) except Exception: raise @@ -3356,12 +3356,11 @@ class Cmd(cmd.Cmd): if not self.editor: raise EnvironmentError("Please use 'set editor' to specify your text editing program of choice.") - editor = utils.quote_string_if_needed(self.editor) + command = utils.quote_string_if_needed(self.editor) if args.file_path: - expanded_path = utils.quote_string_if_needed(os.path.expanduser(args.file_path)) - os.system('{} {}'.format(editor, expanded_path)) - else: - os.system('{}'.format(editor)) + command += " " + utils.quote_string_if_needed(args.file_path) + + self.do_shell(command) @property def _current_script_dir(self) -> Optional[str]: |