Use Path.exec instead of os.execute where we can
This commit is contained in:
parent
6462ac9968
commit
f364eb6887
@ -104,24 +104,26 @@ describe "http://miti.sh/posts", ->
|
|||||||
assert.same request\body!\match("<title>(.*)</title>"), "miti.sh · Posts"
|
assert.same request\body!\match("<title>(.*)</title>"), "miti.sh · Posts"
|
||||||
|
|
||||||
describe "http://git.miti.sh", ->
|
describe "http://git.miti.sh", ->
|
||||||
it "reverse proxies request to gitea through a unix socket", ->
|
it "reverse-proxies request to a gitea unix socket", ->
|
||||||
Path = require "sitegen.path"
|
Path = require "sitegen.path"
|
||||||
socket_fname = "unixstreamsrvr.moon"
|
socket_fname = "unixstreamsrvr.moon"
|
||||||
socket_dir = "/run/gitea"
|
socket_dir = "/run/gitea"
|
||||||
socket_owner = "nobody"
|
socket_owner = "nobody"
|
||||||
basepath = Path.basepath debug.getinfo(1).short_src
|
basepath = Path.basepath debug.getinfo(1).short_src
|
||||||
|
|
||||||
os.execute "mkdir " .. socket_dir
|
Path.mkdir socket_dir
|
||||||
p = io.popen "moon %s"\format Path.join(basepath, socket_fname)
|
server = io.popen "moon %s"\format Path.join(basepath, socket_fname)
|
||||||
os.execute "sleep 0.1"
|
Path.exec "sleep", "0.1"
|
||||||
os.execute "chown -R " .. socket_owner .. " " .. socket_dir
|
Path.exec "chown", "-R", socket_owner, socket_dir
|
||||||
result = Path.read_exec "find", socket_dir, "-type", "s", "-ls"
|
result = Path.read_exec "find", socket_dir, "-type", "s", "-ls"
|
||||||
assert.truthy result\match "nobody%s+root.+" .. Path.join(socket_dir, "gitea.socket")
|
assert.truthy result\match "nobody%s+root.+" .. Path.join(socket_dir, "gitea.socket")
|
||||||
|
|
||||||
request = req "http://git.miti.sh"
|
req "http://git.miti.sh"
|
||||||
pout = p\read"*a"
|
|
||||||
p\close!
|
reqheader = with server\read "*a"
|
||||||
assert.truthy pout\match "Host: git.miti.sh"
|
server\close!
|
||||||
|
|
||||||
|
assert.truthy reqheader\match "Host: git.miti.sh"
|
||||||
|
|
||||||
describe "http://apps.miti.sh", ->
|
describe "http://apps.miti.sh", ->
|
||||||
it "doesn't find it", ->
|
it "doesn't find it", ->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user