mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Provide default for Lua executable env variable
This commit is contained in:
parent
6d0eb8660d
commit
d9640cf027
6 changed files with 45 additions and 15 deletions
|
@ -1,5 +1,10 @@
|
|||
local spawn = require("awful.spawn")
|
||||
|
||||
local lua_executable = os.getenv("LUA_EXECUTABLE")
|
||||
if lua_executable == nil or lua_executable == "" then
|
||||
lua_executable = "lua"
|
||||
end
|
||||
|
||||
-- This file provide a simple, yet flexible, test client.
|
||||
-- It is used to test the `ruled.client`
|
||||
|
||||
|
@ -106,7 +111,7 @@ local pipe
|
|||
local function init()
|
||||
if initialized then return end
|
||||
initialized = true
|
||||
local cmd = { os.getenv("LUA_EXECUTABLE"), "-e", test_client_source }
|
||||
local cmd = { lua_executable, "-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)
|
||||
|
|
|
@ -8,6 +8,11 @@ local lgi = require("lgi")
|
|||
local Gio = lgi.Gio
|
||||
local GdkPixbuf = lgi.GdkPixbuf
|
||||
|
||||
local lua_executable = os.getenv("LUA_EXECUTABLE")
|
||||
if lua_executable == nil or lua_executable == "" then
|
||||
lua_executable = "lua"
|
||||
end
|
||||
|
||||
local header = [[
|
||||
local lgi = require("lgi")
|
||||
local Gdk = lgi.Gdk
|
||||
|
@ -48,7 +53,7 @@ runner.run_steps{
|
|||
|
||||
-- Clear the clipboard to get to a known state
|
||||
function()
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", acquire_and_clear_clipboard },
|
||||
spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
|
||||
{ exit = function() continue = true end })
|
||||
return true
|
||||
end,
|
||||
|
@ -79,7 +84,7 @@ runner.run_steps{
|
|||
|
||||
-- Now set the clipboard to some text
|
||||
continue = false
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", acquire_clipboard_text },
|
||||
spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard_text },
|
||||
{ stdout = function(line)
|
||||
assert(line == "initialisation done",
|
||||
"Unexpected line: " .. line)
|
||||
|
@ -143,7 +148,7 @@ runner.run_steps{
|
|||
|
||||
-- Now set the clipboard to an image
|
||||
continue = false
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", acquire_clipboard_pixbuf },
|
||||
spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard_pixbuf },
|
||||
{ stdout = function(line)
|
||||
assert(line == "initialisation done",
|
||||
"Unexpected line: " .. line)
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
local runner = require("_runner")
|
||||
local spawn = require("awful.spawn")
|
||||
|
||||
local lua_executable = os.getenv("LUA_EXECUTABLE")
|
||||
if lua_executable == nil or lua_executable == "" then
|
||||
lua_executable = "lua"
|
||||
end
|
||||
|
||||
-- Assemble data for the large transfer that will be done later
|
||||
local large_transfer_piece = "a"
|
||||
for _ = 1, 25 do
|
||||
|
@ -86,7 +91,7 @@ runner.run_steps({
|
|||
end
|
||||
end)
|
||||
awesome.sync()
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", check_targets_and_text },
|
||||
spawn.with_line_callback({ lua_executable, "-e", check_targets_and_text },
|
||||
{ stdout = function(line)
|
||||
assert(line == "done", "Unexpected line: " .. line)
|
||||
continue = true
|
||||
|
@ -124,7 +129,7 @@ runner.run_steps({
|
|||
end
|
||||
end)
|
||||
awesome.sync()
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", check_targets_and_text },
|
||||
spawn.with_line_callback({ lua_executable, "-e", check_targets_and_text },
|
||||
{ stdout = function(line)
|
||||
assert(line == "done", "Unexpected line: " .. line)
|
||||
continue = true
|
||||
|
@ -161,7 +166,7 @@ runner.run_steps({
|
|||
end
|
||||
end)
|
||||
awesome.sync()
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", check_large_transfer },
|
||||
spawn.with_line_callback({ lua_executable, "-e", check_large_transfer },
|
||||
{ stdout = function(line)
|
||||
assert(line == "done", "Unexpected line: " .. line)
|
||||
continue = true
|
||||
|
@ -177,7 +182,7 @@ runner.run_steps({
|
|||
-- Now test that :release() works
|
||||
selection_object:release()
|
||||
awesome.sync()
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", check_empty_selection },
|
||||
spawn.with_line_callback({ lua_executable, "-e", check_empty_selection },
|
||||
{ stdout = function(line)
|
||||
assert(line == "done", "Unexpected line: " .. line)
|
||||
continue = true
|
||||
|
@ -196,7 +201,7 @@ runner.run_steps({
|
|||
"Failed to acquire the clipboard selection")
|
||||
selection_object:connect_signal("release", function() selection_released = true end)
|
||||
awesome.sync()
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", acquire_and_clear_clipboard },
|
||||
spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
|
||||
{ exit = function() continue = true end })
|
||||
return true
|
||||
end,
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
local runner = require("_runner")
|
||||
local spawn = require("awful.spawn")
|
||||
|
||||
local lua_executable = os.getenv("LUA_EXECUTABLE")
|
||||
if lua_executable == nil or lua_executable == "" then
|
||||
lua_executable = "lua"
|
||||
end
|
||||
|
||||
local header = [[
|
||||
local lgi = require("lgi")
|
||||
local Gdk = lgi.Gdk
|
||||
|
@ -62,7 +67,7 @@ runner.run_steps{
|
|||
-- Clear the clipboard to get to a known state
|
||||
function()
|
||||
check_state(0, 0)
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", acquire_and_clear_clipboard },
|
||||
spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
|
||||
{ exit = function() continue = true end })
|
||||
return true
|
||||
end,
|
||||
|
@ -81,7 +86,7 @@ runner.run_steps{
|
|||
|
||||
-- Set the clipboard
|
||||
continue = false
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", acquire_clipboard },
|
||||
spawn.with_line_callback({ lua_executable, "-e", acquire_clipboard },
|
||||
{ stdout = function(line)
|
||||
assert(line == "initialisation done",
|
||||
"Unexpected line: " .. line)
|
||||
|
@ -100,7 +105,7 @@ runner.run_steps{
|
|||
|
||||
-- Now clear the clipboard again
|
||||
continue = false
|
||||
spawn.with_line_callback({ os.getenv("LUA_EXECUTABLE"), "-e", acquire_and_clear_clipboard },
|
||||
spawn.with_line_callback({ lua_executable, "-e", acquire_and_clear_clipboard },
|
||||
{ exit = function() continue = true end })
|
||||
|
||||
return true
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
local runner = require("_runner")
|
||||
local spawn = require("awful.spawn")
|
||||
|
||||
local lua_executable = os.getenv("LUA_EXECUTABLE")
|
||||
if lua_executable == nil or lua_executable == "" then
|
||||
lua_executable = "lua"
|
||||
end
|
||||
|
||||
local spawns_done = 0
|
||||
local async_spawns_done = 0
|
||||
local exit_yay, exit_snd = nil, nil
|
||||
|
@ -11,7 +16,7 @@ local exit_yay, exit_snd = nil, nil
|
|||
-- * spawn with startup notification is covered by test-spawn-snid.lua
|
||||
|
||||
local tiny_client = function(class)
|
||||
return {os.getenv("LUA_EXECUTABLE"), "-e", [[
|
||||
return { lua_executable, "-e", [[
|
||||
local lgi = require 'lgi'
|
||||
local Gtk = lgi.require('Gtk')
|
||||
local class = ']]..class..[['
|
||||
|
|
|
@ -4,6 +4,11 @@ local rules = require("ruled.client")
|
|||
local spawn = require("awful.spawn")
|
||||
local gdebug = require("gears.debug")
|
||||
|
||||
local lua_executable = os.getenv("LUA_EXECUTABLE")
|
||||
if lua_executable == nil or lua_executable == "" then
|
||||
lua_executable = "lua"
|
||||
end
|
||||
|
||||
local tiny_client_code_template = [[
|
||||
pcall(require, 'luarocks.loader')
|
||||
local Gtk, class = require('lgi').require('Gtk'), 'client'
|
||||
|
@ -18,8 +23,8 @@ function app:on_activate()
|
|||
end
|
||||
app:run {''}
|
||||
]]
|
||||
local tiny_client = {os.getenv("LUA_EXECUTABLE"), "-e", string.format(tiny_client_code_template, "")}
|
||||
local tiny_client_undecorated = {os.getenv("LUA_EXECUTABLE"), "-e",
|
||||
local tiny_client = { lua_executable, "-e", string.format(tiny_client_code_template, "") }
|
||||
local tiny_client_undecorated = { lua_executable, "-e",
|
||||
string.format(tiny_client_code_template, [[
|
||||
window.decorated = false
|
||||
]])
|
||||
|
|
Loading…
Reference in a new issue