Make zx_daemon:idle/0 safe to call in all cases.

This commit is contained in:
2020-01-05 23:05:51 +09:00
parent ebc870d1ed
commit 93e5bdb9e6
2 changed files with 12 additions and 5 deletions
+8 -4
View File
@@ -372,11 +372,15 @@ start() ->
Error -> done(Error)
end;
["rundir", Path | _] ->
{ok, #{package_id := PackageID}} = zx_lib:read_project_meta(Path),
zx_lib:new_logpath(PackageID);
case zx_lib:read_project_meta(Path) of
{ok, #{package_id := PackageID}} -> zx_lib:new_logpath(PackageID);
Error -> done(Error)
end;
["runlocal" | _] ->
{ok, #{package_id := PackageID}} = zx_lib:read_project_meta(),
zx_lib:new_logpath(PackageID);
case zx_lib:read_project_meta() of
{ok, #{package_id := PackageID}} -> zx_lib:new_logpath(PackageID);
Error -> done(Error)
end;
_ ->
{ok, Version} = zx_lib:string_to_version(os:getenv("ZX_VERSION")),
zx_lib:new_logpath({"otpr", "zx", Version})
+4 -1
View File
@@ -790,7 +790,10 @@ conf(Attribute, Value) ->
%%% (pre) Shutdown
idle() ->
gen_server:call(?MODULE, idle).
case whereis(?MODULE) of
undefined -> ok;
Daemon -> gen_server:call(Daemon, idle)
end.