aboutsummaryrefslogtreecommitdiffstats
path: root/community/tilix/musl-hacks.patch
blob: d706c8354a950b8497de33a23e0021a3a0b8ddb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Upstream: No
Reason: Reverts/Breaks flatpak integration to fix musl build.
--- a/source/gx/tilix/terminal/terminal.d	2019-01-04 01:03:40.000000000 +0100
+++ b/source/gx/tilix/terminal/terminal.d	2019-01-04 23:38:51.915350033 +0100
@@ -2834,31 +2834,8 @@
         if (isFlatpak()) {
             Pty pty = vte.ptyNewSync(VtePtyFlags.DEFAULT, null);
 
-            int pty_master = pty.getFd();
-
-            import core.sys.posix.stdlib: grantpt, unlockpt, ptsname;
-            import core.sys.posix.fcntl: open, O_RDWR;
-
-            if (grantpt(pty_master) != 0) {
-                warning("Failed granting access to slave pseudoterminal device");
-                return false;
-            }
-
-            if (unlockpt(pty_master) != 0) {
-                warning("Failed unlocking slave pseudoterminal device");
-                return false;
-            }
-
-            int[] pty_slaves;
-            pty_slaves ~= open(ptsname(pty_master), O_RDWR | O_CLOEXEC);
-            if (pty_slaves[0] < 0) {
-                warning("Failed opening slave pseudoterminal device");
-                return false;
-            }
-
-            foreach(i; 0 .. 2) {
-                pty_slaves ~= core.sys.posix.unistd.dup(pty_slaves[0]);
-            }
+            import vtec.vte: vte_pty_child_setup;
+            vte_pty_child_setup(pty.getPtyStruct());
 
             import VteVersion = vte.Version;
 
@@ -2892,7 +2869,7 @@
                 onTerminalChildExited(status, vte);
             }
 
-            bool result = sendHostCommand(workingDir, args, envv, pty_slaves, gpid, &exitedCallback);
+            bool result = sendHostCommand(workingDir, args, envv, gpid, &exitedCallback);
 
             vte.setPty(pty);
 
@@ -2971,15 +2948,20 @@
         }
     }
 
-    bool sendHostCommand(string workingDir, string[] args, string[] envv, int[] stdio_fds, out int gpid, HostCommandExitedCallback exitedCallback) {
+    bool sendHostCommand(string workingDir, string[] args, string[] envv, out int gpid, HostCommandExitedCallback exitedCallback) {
         import gio.DBusConnection;
         import gio.UnixFDList;
 
         uint[] handles;
+        int[] fdList;
+
+        fdList ~= std.stdio.stdin.fileno;
+        fdList ~= std.stdio.stdout.fileno;
+        fdList ~= std.stdio.stderr.fileno;
 
         UnixFDList outFdList;
         UnixFDList inFdList = new UnixFDList();
-        foreach(i, fd; stdio_fds) {
+        foreach(i, fd; fdList) {
             handles ~= inFdList.append(fd);
             if (handles[i] == -1) {
                 warning("Error creating fd list handles");
@@ -3071,9 +3053,7 @@
             status = command_status;
         }
 
-        int[] stdio_fds = [0, output.writeEnd.fileno, 2] ~ extra_fds;
-
-        if (!sendHostCommand("/", args, [], stdio_fds, gpid, &commandExited)) {
+        if (!sendHostCommand("/", args, [], gpid, &commandExited)) {
             return null;
         }