diff --git a/src/gmc_con.erl b/src/gmc_con.erl index 3a90294..e1570c2 100644 --- a/src/gmc_con.erl +++ b/src/gmc_con.erl @@ -378,17 +378,19 @@ do_gajudesk() -> GajuDesk = "zx run gajudesk", Command = case os:type() of - {unix, _} -> - "setsid sh -c 'exec nohup " ++ GajuDesk ++ " >/dev/null 2>&1' &"; - {win32, nt} -> - "wscript //B //Nologo " - "-e:VBScript " - "-c:\"CreateObject(\"WScript.Shell\").Run \"\"" - " \"" ++ GajuDesk ++ "\", 0, False\"" + {unix, _} -> detach_unix(GajuDesk); + {win32, nt} -> detach_windows(GajuDesk) end, Out = os:cmd(Command), log(info, "os:cmd(~s) -> ~s", [Command, Out]). +detach_unix(Command) -> + "setsid sh -c 'exec nohup " ++ Command ++ " >/dev/null 2>&1' &". + +detach_windows(Command) -> + PSCmd = "Start-Process -WindowStyle Hidden -FilePath cmd.exe -ArgumentList '/c " ++ Command ++ "'", + "powershell -NoProfile -Command \"" ++ PSCmd ++ "\"". + run_gmc_conf(State = #s{gmc_conf = none, network = Net, acc = Acc, keys = Keys, max_cores = MProcs, max_mem = MMem,