Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
TangentFoxy committed Jan 10, 2018
1 parent b30876c commit cc2978d
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions applications/githook.moon
@@ -1,20 +1,23 @@
lapis = require "lapis"
config = require("lapis.config").get!

execute = (cmd) ->
handle = io.popen cmd
result = handle\read "*a"
handle\close!
return result
-- execute = (cmd) ->
-- handle = io.popen cmd
-- result = handle\read "*a"
-- handle\close!
-- return result

execute = (cmd) ->
return os.execute "sudo -Hu www-data #{cmd} >> logs/update.log 2>&1"
return os.execute "sudo -Hu www-data #{cmd} >> ./logs/updates.log 2>&1"

read = ->
handle = io.open "logs/update.log", "r"
result = handle\read "*a"
handle\close!
return result
handle, err = io.open "./logs/updates.log", "r"
if handle
result = handle\read "*a"
handle\close!
return result
else
return err

class GithookApp extends lapis.Application
[githook: "/githook"]: =>
Expand Down

0 comments on commit cc2978d

Please sign in to comment.