Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/dstack/_internal/core/services/ssh/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,27 @@ async def aopen(self) -> None:
raise get_ssh_error(stderr)

def close(self) -> None:
subprocess.run(self.close_command(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
proc = subprocess.run(
self.close_command(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
if proc.returncode:
logger.error(
"Failed to close SSH tunnel, exit status: %d, output: %s",
proc.returncode,
proc.stdout,
)

async def aclose(self) -> None:
proc = await asyncio.create_subprocess_exec(
*self.close_command(), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
*self.close_command(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
await proc.wait()
if proc.returncode:
logger.error(
"Failed to close SSH tunnel, exit status: %d, output: %s",
proc.returncode,
proc.stdout,
)

async def acheck(self) -> bool:
proc = await asyncio.create_subprocess_exec(
Expand Down