diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-10-18 17:56:46 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-10-18 17:56:46 -0400 |
commit | d1de4e4735507fd2ac20d5ea7f3a8e68f9aeaff1 (patch) | |
tree | 4dd1aa792502e90f996be95d72b166142d8c512c /cmd2 | |
parent | 600ebba66477304cba25d874c7a90ffffbe23676 (diff) | |
download | cmd2-git-d1de4e4735507fd2ac20d5ea7f3a8e68f9aeaff1.tar.gz |
Send all startup script paths to run_script. Previously we didn't do this if the
file was empty, but that showed no record of the run_script command in history.
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/cmd2.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 84945535..7d2cad20 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -498,10 +498,10 @@ class Cmd(cmd.Cmd): # Commands that will run at the beginning of the command loop self._startup_commands = [] - # If a startup script is provided, then execute it in the startup commands + # If a startup script is provided and exists, then execute it in the startup commands if startup_script: startup_script = os.path.abspath(os.path.expanduser(startup_script)) - if os.path.exists(startup_script) and os.path.getsize(startup_script) > 0: + if os.path.exists(startup_script): self._startup_commands.append("run_script '{}'".format(startup_script)) # Transcript files to run instead of interactive command loop |