Skip to content

Commit 4b50b18

Browse files
committed
fix: Update io_redirection_handler with improved error handling
1 parent d36e678 commit 4b50b18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mcp_shell_server/io_redirection_handler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ async def setup_redirects(
123123
if directory and redirects["stdout"]
124124
else str(redirects["stdout"])
125125
)
126-
mode = "a" if redirects["stdout_append"] else "w"
126+
mode = "a" if redirects.get("stdout_append") else "w"
127127
try:
128128
handles["stdout"] = open(path, mode)
129-
except IOError as e:
129+
except (IOError, PermissionError) as e:
130130
raise ValueError(f"Failed to open output file: {e}") from e
131131
else:
132132
handles["stdout"] = asyncio.subprocess.PIPE

0 commit comments

Comments
 (0)