+
+// daemonTestSocketDir returns a new short directory under /tmp for data that
+// holds a daemon socket. t.TempDir holds the test name and the TMPDIR of the
+// shell, so its paths can pass the 107-byte limit of a Unix socket path.
+func daemonTestSocketDir(t *testing.T) string {
+ t.Helper()
+
+ dir, err := os.MkdirTemp("/tmp", "onechat-")
+ require.NoError(t, err)
+
+ t.Cleanup(func() {
+ require.NoError(t, os.RemoveAll(dir))
+ })
+
+ return dir
+}