Add Docker/Podman container management over SSH: container list with status, ports, CPU and memory; shell and live logs in terminal tabs; start, stop, restart and remove
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+7
-3
@@ -137,15 +137,19 @@ class SshManager {
|
||||
|
||||
const env = host.env ? Object.fromEntries(host.env.split('\n').filter(Boolean).map((l) => l.split('=').map((s) => s.trim()))) : undefined;
|
||||
await new Promise((res, rej) => {
|
||||
conn.shell({ term: 'xterm-256color', cols, rows }, { env }, (err, stream) => {
|
||||
const pty = { term: 'xterm-256color', cols, rows };
|
||||
const onStream = (err, stream) => {
|
||||
if (err) return rej(err);
|
||||
sess.stream = stream;
|
||||
stream.on('data', (d) => send('data', d.toString('utf8')));
|
||||
stream.stderr.on('data', (d) => send('data', d.toString('utf8')));
|
||||
stream.on('close', () => conn.end());
|
||||
if (host.startupCommand) stream.write(host.startupCommand + '\n');
|
||||
if (host.startupCommand && !host.execCommand) stream.write(host.startupCommand + '\n');
|
||||
res();
|
||||
});
|
||||
};
|
||||
// execCommand: statt Login-Shell einen Befehl mit PTY starten (z. B. docker exec -it …)
|
||||
if (host.execCommand) conn.exec(host.execCommand, { pty, env }, onStream);
|
||||
else conn.shell(pty, { env }, onStream);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user