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 82 83 84 85 86 87 88 89 90 91 92 93 94
|
From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
Date: Sat, 13 Sep 2025 01:22:24 +0200
Subject: lib, tests: use GioUnix to use platform-specific Gio classes
Bug-Debian: https://bugs.debian.org/1115591
Origin: https://github.com/awesomeWM/awesome/pull/4022
---
lib/awful/spawn.lua | 5 +++--
tests/_client.lua | 11 ++++++-----
tests/test-spawn.lua | 2 +-
3 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/lib/awful/spawn.lua b/lib/awful/spawn.lua
index 3ffb1f9..33202e7 100644
--- a/lib/awful/spawn.lua
+++ b/lib/awful/spawn.lua
@@ -225,6 +225,7 @@ local capi =
}
local lgi = require("lgi")
local Gio = lgi.Gio
+local GioUnix = lgi.GioUnix
local GLib = lgi.GLib
local util = require("awful.util")
local gtable = require("gears.table")
@@ -411,11 +412,11 @@ function spawn.with_line_callback(cmd, callbacks)
end
end
if have_stdout then
- spawn.read_lines(Gio.UnixInputStream.new(stdout, true),
+ spawn.read_lines(GioUnix.InputStream.new(stdout, true),
stdout_callback, step_done, true)
end
if have_stderr then
- spawn.read_lines(Gio.UnixInputStream.new(stderr, true),
+ spawn.read_lines(GioUnix.InputStream.new(stderr, true),
stderr_callback, step_done, true)
end
assert(stdin == nil)
diff --git a/tests/_client.lua b/tests/_client.lua
index 349a007..f06a76b 100644
--- a/tests/_client.lua
+++ b/tests/_client.lua
@@ -8,6 +8,7 @@ local lgi = require 'lgi'
local Gdk = lgi.require('Gdk')
local Gtk = lgi.require('Gtk')
local Gio = lgi.require('Gio')
+local GioUnix = lgi.require('GioUnix')
Gtk.init()
local function open_window(class, title, options)
@@ -68,7 +69,7 @@ end)
coro()
-- Read lines from stdin and feed them to the coroutine
-local stdin = Gio.UnixInputStream.new(0, false)
+local stdin = GioUnix.InputStream.new(0, false)
stdin = Gio.DataInputStream.new(stdin)
local read_start, read_finish
@@ -96,7 +97,7 @@ Gtk:main{...}
]]
local lgi = require("lgi")
-local Gio = lgi.require("Gio")
+local GioUnix = lgi.require("GioUnix")
local initialized = false
local pipe
@@ -105,9 +106,9 @@ local function init()
initialized = true
local cmd = { "lua", "-e", test_client_source }
local _, _, stdin, stdout, stderr = awesome.spawn(cmd, false, true, true, true)
- pipe = Gio.UnixOutputStream.new(stdin, true)
- stdout = Gio.UnixInputStream.new(stdout, true)
- stderr = Gio.UnixInputStream.new(stderr, true)
+ pipe = GioUnix.OutputStream.new(stdin, true)
+ stdout = GioUnix.InputStream.new(stdout, true)
+ stderr = GioUnix.InputStream.new(stderr, true)
spawn.read_lines(stdout, function(...) print("_client", ...) end)
spawn.read_lines(stderr, function(...) print("_client", ...) end)
end
diff --git a/tests/test-spawn.lua b/tests/test-spawn.lua
index 2af0974..d5da2e5 100644
--- a/tests/test-spawn.lua
+++ b/tests/test-spawn.lua
@@ -105,7 +105,7 @@ local steps = {
local pid, _, _, stdout = awesome.spawn({ "sh", "-c", "echo $AWESOME_SPAWN_TEST_VAR $HOME $USER" },
false, false, true, false, nil, { "AWESOME_SPAWN_TEST_VAR=42" })
assert(type(pid) ~= "string", pid)
- spawn.read_lines(require("lgi").Gio.UnixInputStream.new(stdout, true),
+ spawn.read_lines(require("lgi").GioUnix.InputStream.new(stdout, true),
function(line)
assert(not read_line)
read_line = true
|