mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-14 16:38:40 +08:00
fix: port hook session and dashboard safety fixes
Ports suggest-compact session_id isolation and dashboard terminal/document launch safety onto current main.
This commit is contained in:
@@ -45,7 +45,7 @@ def build_terminal_launch(
|
||||
if resolved_os_name == 'nt':
|
||||
creationflags = getattr(subprocess, 'CREATE_NEW_CONSOLE', 0)
|
||||
return (
|
||||
['cmd.exe', '/k', 'cd', '/d', path],
|
||||
['cmd.exe'],
|
||||
{
|
||||
'cwd': path,
|
||||
'creationflags': creationflags,
|
||||
@@ -59,3 +59,12 @@ def build_terminal_launch(
|
||||
['x-terminal-emulator', '-e', 'bash', '-lc', 'cd -- "$1"; exec bash', 'bash', path],
|
||||
{},
|
||||
)
|
||||
|
||||
|
||||
def launch_terminal(path: str) -> None:
|
||||
"""Open a terminal at the given path after validating the target directory."""
|
||||
canonical = os.path.realpath(path)
|
||||
if not os.path.isdir(canonical):
|
||||
raise ValueError(f"Path is not a valid directory: {canonical!r}")
|
||||
argv, kwargs = build_terminal_launch(canonical)
|
||||
subprocess.Popen(argv, **kwargs) # noqa: S603 - list argv, no shell=True, path validated above
|
||||
|
||||
Reference in New Issue
Block a user