History missing if multiple shells open #1412
-
When running multiple shell sessions, it looks like history from one session can be lost. This seems to happen because each session downloads the history from file on startup & maintains this own version of the history and writes it to the file upon exit. From what I’ve checked in the code, cmd2 stores the entire history in self.history, but it doesn’t appear to read the file contents & then append the extra cmd history into the file; it just writes its own version of the entire history onto the file. As a result, changes made in other sessions may get overwritten. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can run as many instances as you want as long as they are started from different locations in your filesystem. Each instance reads the history from a fixed relative path on startup and writes the history back to the same fixed relative location on shutdown. This works great for the use case where you have a single user running at different times. If you have multiple users running simultaneously, we support that as long as they are launching the application from a different directory path. |
Beta Was this translation helpful? Give feedback.
cmd2
makes an implicit assumption that only a single instance will be running at a time based out of the same directory.You can run as many instances as you want as long as they are started from different locations in your filesystem. Each instance reads the history from a fixed relative path on startup and writes the history back to the same fixed relative location on shutdown.
This works great for the use case where you have a single user running at different times. If you have multiple users running simultaneously, we support that as long as they are launching the application from a different directory path.