sct/lib/sct/commands/dev.rb in sct-1.0.6 vs sct/lib/sct/commands/dev.rb in sct-1.0.7
- old
+ new
@@ -36,13 +36,21 @@
service, service_spec = services.first
container = service_spec["container_name"]
command = service_spec["command"] || ""
+ if Sct::Helper.is_windows?
+ host_machine_IP = (options.wsl_debugger ? `hostname -I | awk '{print $1}'` : `powershell.exe -c '(Test-Connection -ComputerName $env:computername -count 1).ipv4address.IPAddressToString' | dos2unix`).chomp
+ elsif Sct::Helper.is_mac_os?
+ host_machine_IP = `ipconfig getifaddr $(route get 8.8.8.8 | awk '/interface: / {print $2; }')`.chomp
+ else
+ host_machine_IP = `hostname -I | awk '{print $1}'`.chomp
+ end
+
env = {
"PUID" => `id -u`.chomp,
"PGID" => `id -g`.chomp,
- "HOST_MACHINE_IP" => (options.wsl_debugger ? `hostname -I | awk '{print $1}'` : `powershell.exe -c '(Test-Connection -ComputerName $env:computername -count 1).ipv4address.IPAddressToString' | dos2unix`).chomp,
+ "HOST_MACHINE_IP" => host_machine_IP,
"IDE_DEBUG_KEY" => "PHPSTORM",
"IDE_DEBUG_SERVER" => "docker",
}
if options.pull