Skip to content

Commit 8c19a08

Browse files
committed
Daemon - further windows-focussed tweaks
1 parent 1a0eb96 commit 8c19a08

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

app/server/ruby/bin/daemon.rb

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,13 +968,21 @@ def initialize(ports, kill_switch, token)
968968
ENV["TAU_ENV"] = "#{ENV["SONIC_PI_ENV"] || unified_opts[:env] || "prod"}"
969969
ENV["MIX_ENV"] = ENV["TAU_ENV"]
970970
ENV["TAU_PHX_PORT"] = "#{@phx_port}"
971-
ENV["TAU_LOG_PATH"] = "#{Paths.tau_log_path}"
972-
ENV["TAU_BOOT_LOG_PATH"] = "#{Paths.tau_boot_log_path}"
971+
972+
if Util.os == :windows
973+
ENV["TAU_LOG_PATH"] = File.expand_path(Paths.tau_log_path).gsub('/', '\\')
974+
ENV["TAU_BOOT_LOG_PATH"] = File.expand_path(Paths.tau_boot_log_path).gsub('/', '\\')
975+
else
976+
ENV["TAU_LOG_PATH"] = "#{Paths.tau_log_path}"
977+
ENV["TAU_BOOT_LOG_PATH"] = "#{Paths.tau_boot_log_path}"
978+
end
973979

974980
if Util.os == :windows
975981
if ENV["TAU_ENV"] == "prod"
976-
ENV["RELEASE_SYS_CONFIG"] = "#{Paths.tau_release_sys_config_path}"
977-
ENV["RELEASE_ROOT"] = "#{Paths.tau_release_root}"
982+
ENV["RELEASE_SYS_CONFIG"] = File.expand_path(Paths.tau_release_sys_config_path).gsub('/', '\\')
983+
ENV["RELEASE_ROOT"] = File.expand_path(Paths.tau_release_root).gsub('/', '\\')
984+
ENV["TAU_LOG_PATH"] = File.expand_path(Paths.tau_log_path).gsub('/', '\\')
985+
ENV["TAU_BOOT_LOG_PATH"] = File.expand_path(Paths.tau_boot_log_path).gsub('/', '\\')
978986

979987
cmd = File.expand_path(Paths.tau_release_erl_bin_path)
980988

@@ -998,7 +1006,21 @@ def initialize(ports, kill_switch, token)
9981006
args = [Paths.tau_boot_path]
9991007
end
10001008

1009+
# Start without internal log recording
10011010
super(cmd, args, Paths.tau_boot_log_path)
1011+
1012+
enable_internal_log_recording!
1013+
1014+
1015+
sleep 2
1016+
# Check if process exited immediately
1017+
unless process_running?
1018+
Util.log "Tau process exited immediately. Exit status: #{@wait_thr.value.exitstatus if @wait_thr}"
1019+
Util.log "Tau output: #{@log}" if @log && !@log.empty?
1020+
raise "Tau failed to start - process exited immediately"
1021+
end
1022+
1023+
disable_internal_log_recording!
10021024
end
10031025

10041026
def restart!

0 commit comments

Comments
 (0)