2024-07-04 15:21:04 +00:00
|
|
|
module Terminal
|
|
|
|
extend self
|
|
|
|
|
|
|
|
@@terminal_process : Process | Nil = nil
|
|
|
|
|
2024-07-04 16:10:32 +00:00
|
|
|
def start_terminal(_args = ["sh"], readonly = false)
|
2024-07-04 15:21:04 +00:00
|
|
|
args = ["-p", "7681", "-c", "admin:admin", "-o"]
|
|
|
|
args += ["-W"] unless readonly
|
|
|
|
args += _args
|
|
|
|
# We have a process there, kill it
|
|
|
|
@@terminal_process.as(Process).terminate if !@@terminal_process.nil?
|
|
|
|
@@terminal_process = Process.new(
|
|
|
|
command: "/usr/bin/ttyd",
|
|
|
|
args: args)
|
|
|
|
Log.info {"Terminal started on port 7681"}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|