mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
code review changes
This commit is contained in:
parent
4e201bb8f4
commit
a2958c7820
1 changed files with 1 additions and 7 deletions
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/acarl005/stripansi"
|
"github.com/acarl005/stripansi"
|
||||||
|
|
@ -106,7 +105,7 @@ func tunneledDockerHost(ctx context.Context, remoteHost string) (string, error)
|
||||||
// set a reasonable timeout, then wait for the socket to dial successfully
|
// set a reasonable timeout, then wait for the socket to dial successfully
|
||||||
// before attempting to create a new docker client
|
// before attempting to create a new docker client
|
||||||
const socketTunnelTimeout = 8 * time.Second
|
const socketTunnelTimeout = 8 * time.Second
|
||||||
ctx, cancel := context.WithTimeout(ctx, 8*time.Second)
|
ctx, cancel := context.WithTimeout(ctx, socketTunnelTimeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
err = retrySocketDial(ctx, localSocket)
|
err = retrySocketDial(ctx, localSocket)
|
||||||
|
|
@ -153,11 +152,6 @@ func tryDial(ctx context.Context, socketPath string) error {
|
||||||
|
|
||||||
func tunnelSSH(ctx context.Context, host, localSocket string) error {
|
func tunnelSSH(ctx context.Context, host, localSocket string) error {
|
||||||
cmd := exec.CommandContext(ctx, "ssh", "-L", localSocket+":/var/run/docker.sock", host, "-N")
|
cmd := exec.CommandContext(ctx, "ssh", "-L", localSocket+":/var/run/docker.sock", host, "-N")
|
||||||
// when lazydocker exits, kill the SSH tunnel
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
|
||||||
// TODO: ensure we get this behavior on all platforms
|
|
||||||
Pdeathsig: syscall.SIGKILL,
|
|
||||||
}
|
|
||||||
err := cmd.Start()
|
err := cmd.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue