Skip to content

Instantly share code, notes, and snippets.

@ZeroPivot
Created September 26, 2018 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZeroPivot/d6c2b62085ee312d3c546caebbcc0d42 to your computer and use it in GitHub Desktop.
Save ZeroPivot/d6c2b62085ee312d3c546caebbcc0d42 to your computer and use it in GitHub Desktop.
get '/stderr' do
title "STDERR logs"
if File.exists?("is_local.config")
local=true
FileUtils.touch("/mnt/c/programming/sinatra_projects/comicman-remote/log/stderr")
else
local=false
FileUtils.touch("/root/comicman/log/stderr")
end
stderr = File.open("/mnt/c/programming/sinatra_projects/comicman-remote/log/stderr") if local #local; WSL
stderr = File.open('/root/comicman/log/stderr') if !local #aritywolf.net; remote
stderr.each_line do |line|
@lines||=[]
@lines << line
end
erb :std
end
get '/stdout' do
title "STDOUT logs"
if File.exists?("is_local.config")
local=true
FileUtils.touch("/mnt/c/programming/sinatra_projects/comicman-remote/log/stdout")
else
local=false
FileUtils.touch("/root/comicman/log/stdout")
end
stderr = File.open("/mnt/c/programming/sinatra_projects/comicman-remote/log/stdout") if local #local; WSL
stderr = File.open('/root/comicman/log/stdout') if !local #aritywolf.net; remote
stderr.each_line do |line|
@lines||=[]
@lines << line
end
erb :std
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment