Skip to content
Snippets Groups Projects

app-t-syslog

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Amanda Cameron
    app-t-syslog.lua 823 B
    local _, _, tid = ...
    local needTerm
    needTerm = (not tid) or string.sub(tid, 1, 12) ~= "x.neo.pub.t/"
    
    local close
    
    if needTerm then
      tid = nil
      assert(neo.executeAsync("svc-t",
                              function(session)
                                tid = session.access
                                close = session.close
                                neo.scheduleTimer(0)
                              end, "t-syslog"))
      while coroutine.yield() ~= "k.timer" do end
    end
    
    local term = neo.requireAccess(tid, "terminal")
    neo.requireAccess("s.h._kosneo_syslog")
    
    while true do
      local data = {coroutine.yield()}
      local evt = table.remove(data, 1)
    
      if evt == "k.procdie" then
        if data[1] == term.pid then
          break
        end
      elseif evt == "s.h._kosneo_syslog" then
        term.write(table.concat(" ", data) .. "\n")
      end
    end
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment