Merged changes from Deedra.
This commit is contained in:
commit
7ae2801e53
3 files changed
+9
-5
No files matched your search
@@ -22,7 +22,7 @@ import "strings"
|
||||
const Name = "Cthulhu"
|
||||
|
||||
const Version = "2026.10.25"
|
||||
const Channel = "master"
|
||||
const Channel = "testing"
|
||||
|
||||
var Build = Version
|
||||
|
||||
|
||||
@@ -188,7 +188,10 @@ func (manager *Manager) launch(child *process, source prefix, now time.Time) err
|
||||
cmd.WaitDelay = 200 * time.Millisecond
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
|
||||
environment := os.Environ()
|
||||
for _, key := range []string{"DISPLAY", "WAYLAND_DISPLAY", "XDG_RUNTIME_DIR", "DBUS_SESSION_BUS_ADDRESS"} {
|
||||
// Hooks need the application's display, but D-Bus requests go to this
|
||||
// reader's session. Applications launched from another session bus must
|
||||
// not redirect the helper away from the service supervising it.
|
||||
for _, key := range []string{"DISPLAY", "WAYLAND_DISPLAY", "XDG_RUNTIME_DIR"} {
|
||||
if value := source.environment[key]; value != "" {
|
||||
environment = append(environment, key+"="+value)
|
||||
}
|
||||
|
||||
@@ -219,13 +219,14 @@ func TestManagerLaunchesAndStopsHelperForActivePrefix(t *testing.T) {
|
||||
if err := os.WriteFile(filepath.Join(proc, "cmdline"), []byte("application.exe\x00"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := os.WriteFile(filepath.Join(proc, "environ"), []byte("WINEPREFIX="+prefixPath+"\x00WINELOADER="+loader+"\x00"), 0600); err != nil {
|
||||
if err := os.WriteFile(filepath.Join(proc, "environ"), []byte("WINEPREFIX="+prefixPath+"\x00WINELOADER="+loader+"\x00DBUS_SESSION_BUS_ADDRESS=unix:path=/application-bus\x00DISPLAY=:7\x00"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := filepath.Join(root, "helper-output")
|
||||
t.Setenv("CTHULHU_TEST_WINE_OUTPUT", output)
|
||||
t.Setenv("DBUS_SESSION_BUS_ADDRESS", "unix:path=/reader-bus")
|
||||
helper := filepath.Join(root, "helper")
|
||||
script := "#!/bin/sh\nprintf '%s\\n' \"$WINEPREFIX\" \"$CTHULHU_WINE_ACCESS_MANAGED\" > \"$CTHULHU_TEST_WINE_OUTPUT\"\nexec sleep 30\n"
|
||||
script := "#!/bin/sh\nprintf '%s\\n' \"$WINEPREFIX\" \"$CTHULHU_WINE_ACCESS_MANAGED\" \"$DBUS_SESSION_BUS_ADDRESS\" \"$DISPLAY\" > \"$CTHULHU_TEST_WINE_OUTPUT\"\nexec sleep 30\n"
|
||||
if err := os.WriteFile(helper, []byte(script), 0700); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -243,7 +244,7 @@ func TestManagerLaunchesAndStopsHelperForActivePrefix(t *testing.T) {
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
if string(contents) != prefixPath+"\n1\n" {
|
||||
if string(contents) != prefixPath+"\n1\nunix:path=/reader-bus\n:7\n" {
|
||||
t.Fatalf("helper environment = %q", contents)
|
||||
}
|
||||
stopCtx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
|
||||
Reference in new issue
Block a user