Make zx_daemon:idle/0 safe to call in all cases.
This commit is contained in:
parent
ebc870d1ed
commit
93e5bdb9e6
@ -372,11 +372,15 @@ start() ->
|
|||||||
Error -> done(Error)
|
Error -> done(Error)
|
||||||
end;
|
end;
|
||||||
["rundir", Path | _] ->
|
["rundir", Path | _] ->
|
||||||
{ok, #{package_id := PackageID}} = zx_lib:read_project_meta(Path),
|
case zx_lib:read_project_meta(Path) of
|
||||||
zx_lib:new_logpath(PackageID);
|
{ok, #{package_id := PackageID}} -> zx_lib:new_logpath(PackageID);
|
||||||
|
Error -> done(Error)
|
||||||
|
end;
|
||||||
["runlocal" | _] ->
|
["runlocal" | _] ->
|
||||||
{ok, #{package_id := PackageID}} = zx_lib:read_project_meta(),
|
case zx_lib:read_project_meta() of
|
||||||
zx_lib:new_logpath(PackageID);
|
{ok, #{package_id := PackageID}} -> zx_lib:new_logpath(PackageID);
|
||||||
|
Error -> done(Error)
|
||||||
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
{ok, Version} = zx_lib:string_to_version(os:getenv("ZX_VERSION")),
|
{ok, Version} = zx_lib:string_to_version(os:getenv("ZX_VERSION")),
|
||||||
zx_lib:new_logpath({"otpr", "zx", Version})
|
zx_lib:new_logpath({"otpr", "zx", Version})
|
||||||
|
|||||||
@ -790,7 +790,10 @@ conf(Attribute, Value) ->
|
|||||||
%%% (pre) Shutdown
|
%%% (pre) Shutdown
|
||||||
|
|
||||||
idle() ->
|
idle() ->
|
||||||
gen_server:call(?MODULE, idle).
|
case whereis(?MODULE) of
|
||||||
|
undefined -> ok;
|
||||||
|
Daemon -> gen_server:call(Daemon, idle)
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user