Skip to content

Commit 84934b5

Browse files
author
zach
committed
fix: history file
1 parent 1c0fdb2 commit 84934b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mcpx_py/__main__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,19 @@ def killtree(pid):
149149
async def run(args):
150150
# Setup command history
151151
histfile = os.path.join(
152-
os.environ.get("XTP_PLUGIN_CACHE_DIR", "/tmp"), ".mcpx-client-history"
152+
os.environ.get("XTP_PLUGIN_CACHE_DIR", os.environ["HOME"]),
153+
".mcpx-client-history",
153154
)
154155
try:
155-
os.makedirs(os.path.dirname(histfile), exist_ok=True)
156156
readline.set_history_length(1000)
157157

158158
# Try to read existing history
159159
try:
160160
readline.read_history_file(histfile)
161161
except FileNotFoundError:
162162
pass
163+
except PermissionError:
164+
pass
163165

164166
# Register history save on exit
165167
atexit.register(readline.write_history_file, histfile)

0 commit comments

Comments
 (0)