undo weird change
This commit is contained in:
parent
c0718589c8
commit
b8f854c8f0
@ -12,8 +12,8 @@ sandbox(Code) ->
|
|||||||
Tag = make_ref(),
|
Tag = make_ref(),
|
||||||
{Pid, Ref} = spawn_monitor(fun() -> Parent ! {Tag, Code()} end),
|
{Pid, Ref} = spawn_monitor(fun() -> Parent ! {Tag, Code()} end),
|
||||||
receive
|
receive
|
||||||
{Tag1, Res} when Tag1 =:= Tag -> erlang:demonitor(Ref, [flush]), {ok, Res};
|
{Tag, Res} -> erlang:demonitor(Ref, [flush]), {ok, Res};
|
||||||
{'DOWN', Ref1, process, Pid1, Reason} when Ref1 =:= Ref andalso Pid1 =:= Pid -> {error, Reason}
|
{'DOWN', Ref, process, Pid, Reason} -> {error, Reason}
|
||||||
after 100 ->
|
after 100 ->
|
||||||
exit(Pid, kill),
|
exit(Pid, kill),
|
||||||
{error, loop}
|
{error, loop}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user