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; }