aboutsummaryrefslogtreecommitdiffstats
path: root/test_.lua
diff options
context:
space:
mode:
authoronefang2025-05-28 10:42:37 +1000
committeronefang2025-05-28 10:42:37 +1000
commit298d75d46ba6bd26646c9c6a51aa0c932fadeb33 (patch)
tree913519a0e25f7a6c40d81aafae14145d98434102 /test_.lua
parentNeaten up the white space. (diff)
downloadJackOnAllDevices-298d75d46ba6bd26646c9c6a51aa0c932fadeb33.zip
JackOnAllDevices-298d75d46ba6bd26646c9c6a51aa0c932fadeb33.tar.gz
JackOnAllDevices-298d75d46ba6bd26646c9c6a51aa0c932fadeb33.tar.bz2
JackOnAllDevices-298d75d46ba6bd26646c9c6a51aa0c932fadeb33.tar.xz
Switch to using the standard polygLua.HEADmaster
Diffstat (limited to 'test_.lua')
-rwxr-xr-xtest_.lua186
1 files changed, 0 insertions, 186 deletions
diff --git a/test_.lua b/test_.lua
deleted file mode 100755
index 9e1931a..0000000
--- a/test_.lua
+++ /dev/null
@@ -1,186 +0,0 @@
1#!/usr/bin/env luajit
2
3if type(jit) == 'table' then
4 print(arg[0] .. ' is being run by ' .. jit.version .. ' under ' .. jit.os .. ' on a ' .. jit.arch .. '. Lua version ' .. _VERSION)
5else
6 print(arg[0] .. ' is being run by Lua version ' .. _VERSION)
7end
8
9
10local _ = require 'PolygLua'
11
12
13I'Starting from the top.'
14
15Help = [[
16This is part of the blah blah blah...
17]]
18
19Version = '0.0 crap'
20
21local options =
22{
23 start = {help = 'Command to start the scanning process, for Sys V init.', value = 'blah'},
24-- restart = {start},
25-- ['force-reload'] = {start},
26 status = {help = 'Command to check the status of the scanning process, for Sys V init.',},
27 stop = {help = 'Command to stop the scanning process, for Sys V init.',},
28 JACK = {help = 'Command to start the JACK stuff, for users.',},
29 STOP = {help = 'Command to stop the JACK stuff, for users.',
30 func = function(self, options, a, args, i)
31--[=[
32 _.killEmAll{'qsynth'}
33 __[[
34 a2j_control --stop
35 sleep 2
36 a2j_control --exit
37 sleep 2
38 ]]:Do()
39 _.killEmAll{'alsa_in', 'alsa_out', 'zita-a2j', 'zita-j2a', 'aseqjoy', 'jack-plumbing'}
40 __[[
41 sleep 2
42 jack_control stop
43 sleep 2
44 jack_control exit
45 sleep 2
46 ]]:Do()
47 _.killEmAll{'jmcore', 'qjackctl'}
48 -- Catia is python, and no easy way to kill it.
49 -- Also it keeps jackdbus alive, no matter how hard you kill it.
50 __'pkill -TERM -u $USER -f catia':Do()
51 __'sleep 2':Do()
52 _.killEmAll{'jackdbus', 'a2jmidid'}
53]=]
54 end
55 },
56 install =
57 {
58 help = 'Command to install aataaj.lua',
59 func = function(self, options, a, args, i)
60 local w = __[[whoami]]:noErr():Do().lines[1]
61 local d = __[[pwd]]:noErr():Do().lines[1]
62 if 'root' ~= w then
63 E'Need to be root user to install.'
64 else
65 print('INSTALLING!!!')
66 __[[#!/bin/bash
67 echo "Installing PolygLua"
68 ./PolygLua.lua -vvvv
69 ]]:log():show():Do()
70 end
71 os.exit(0)
72 end
73 },
74}
75options['restart'] = options['start']
76options['force-reload'] = options['start']
77
78print('start = ' .. options.start.value)
79_.parse(arg, options, 'test_')
80print('start = ' .. options.start.value)
81print('stop = ' .. options.stop.value)
82
83
84
85__[[
86 echo -n "This'll print forking later. "
87 date
88 sleep 2
89]]:log():show():fork('echo -n "later is "; date')
90print('')
91
92
93local GUI = 'qjackctl'
94if _.runnable'catia' then GUI = 'catia' end
95local speaker = 'espeak'
96if _.runnable'espeak-ng' then speaker = 'espeak-ng' end
97print('' .. GUI .. ' ' .. speaker)
98print('')
99
100for i,l in ipairs(__'free -h':log():Do().lines) do
101 print(l)
102end
103print('')
104
105for i,l in ipairs(__'uname -a\nfree -h':log():Do().lines) do
106 print(l)
107end
108print('')
109
110__'uname -a':log():Then'free -h':show():Do()
111print('')
112
113__{'uname -a', 'free -h'}:log():show():Do()
114print('')
115
116
117print(__[[#!/bin/NoSuchCommand
118 echo "Should not print."
119]]:log():show():Do().status)
120print('')
121
122__[[#!/bin/bash
123 echo "G'day world from bash."
124]]:log():show():Do()
125print('')
126
127print(__[[#!/usr/bin/tcc -run
128 #include <tcclib.h>
129
130 int main()
131 {
132 printf("G'day world from C.\n");
133 return 1;
134 }
135]]:log():show():Do().status)
136print('')
137
138__[[#!/usr/bin/env luajit
139 print("G'day " .. "world " .. [=[from]=] .. ' Lua.')
140]]:log():show():Do()
141print('')
142
143__[[#!/usr/bin/perl
144 print "G'day world from perl.\n";
145]]:log():show():Do()
146print('')
147
148__[[#!/usr/bin/env php
149<?php
150 print("G'day world from php.\n");
151]]:log():show():Do()
152print('')
153
154-- Note no indent for Python, coz whitespace is significant.
155__[[#!/usr/bin/env python3
156print("G'day world from python.")
157]]:log():show():Do()
158print('')
159
160__[[#!/usr/bin/ruby
161 puts "G'day world from ruby."
162]]:log():show():Do()
163print('')
164
165
166print(__'true':log():show():Do().status)
167print(__'false':log():show():Do().status)
168print(__'exit 42':log():show():Do().status)
169print(__'return 42':log():show():Do().status)
170print(__'command NoSuchCommand':log():show():Do().status)
171
172
173--__'qpdfview':forkOnce()
174--__'qpdfview':forkOnce()
175
176print('')
177
178for i,a in ipairs(arg) do print('arg[' .. i .. '] = ' .. a) end
179print('')
180for k,a in pairs(arg) do print('arg[' .. k .. '] = ' .. a) end
181
182__'date':log():show():Do()
183-- Should get that "later" thing printed while the sleep is happening.
184__'date; sleep 5; date':log():show():Do()
185
186