neden olduğunu anlayamıyorum Bir denetleyiciyi ilk kez uygulamak için çalışıyorum ve belgelerden anlayamadığım sorunlara koşuyorum. Özellikle, SlowRamp.flood
kullanarak işlem yapmaya başladığımda {:error, {:invalid_child_spec, []}}
olsun.Elixir: denetlenen süreç için invalid_child_spec. Neden
Bu çok basit bir uygulamadır ve yeni slow_ramp --sup kullanılarak yapılmıştır.
defmodule SlowRamp do
use Application
# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
worker(SlowRamp.Flood, [])
]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: SlowRamp.Supervisor]
Supervisor.start_link(children, opts)
end
def flood do
Supervisor.start_child(SlowRamp.Supervisor, [])
end
end
Çocuğum işlevi/dosya ./lib/SlowRamp/flood.ex
olduğunu ve şuna benzer:: ./lib/slow_ramp.ex
yılında
ana dosya
defmodule SlowRamp.Flood do
def start_link do
Task.start_link(fn -> start end)
end
defp start do
receive do
{:start, host, caller} ->
send caller, System.cmd("cmd", ["opt"])
end
end
end
Herhangi bir yardım çok takdir edilecektir. Teşekkürler!
Ah geçersiz olduğunu bildiren bir nedenle Thats
, ben yanlış anladığını Bu nasıl çalıştı. Teşekkür ederim! Yardımı gerçekten takdir ediyorum! – kkirsche
Mükemmel cevap. Burada Erlang amirlerine çok güveniyoruz ... daha iyi hata mesajlarımız olabilir ve bir gün (umarız!). –