Allow launched background process to work with --allow-remote-control

Use a dedicated socketpair for such processes. Fixes #6712
This commit is contained in:
Kovid Goyal
2023-10-18 19:56:07 +05:30
parent a9b412baba
commit 314fe4fe4a
11 changed files with 275 additions and 92 deletions

View File

@@ -5,6 +5,7 @@ package utils
import (
"fmt"
"runtime"
"strconv"
"strings"
"github.com/seancfoley/ipaddress-go/ipaddr"
@@ -37,6 +38,13 @@ func ParseSocketAddress(spec string) (network string, addr string, err error) {
}
return
}
if network == "fd" {
fd := -1
if fd, err = strconv.Atoi(addr); err != nil || fd < 0 {
err = fmt.Errorf("Not a valid file descriptor number: %#v. Cannot use: %s", addr, spec)
}
return
}
err = fmt.Errorf("Unknown network type: %#v in socket address: %s", network, spec)
return
}