Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

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.

You must be logged in to vote

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.

Replies: 1 comment

Comment options

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.

You must be logged in to vote
0 replies
Answer selected by tleonhardt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.