diff --git a/lib/ex_cmd/process.ex b/lib/ex_cmd/process.ex index 4aa3a6e..a9ee39f 100644 --- a/lib/ex_cmd/process.ex +++ b/lib/ex_cmd/process.ex @@ -195,8 +195,8 @@ defmodule ExCmd.Process do ``` # sleep command does not watch for stdin or stdout, so closing the # pipe does not terminate the sleep command. - iex> {:ok, p} = Process.start_link(~w(sleep 100000000)) # sleep indefinitely - iex> Process.await_exit(p, 500) # ensure `await_exit` finish within `500ms`. By default it waits for 5s + iex> {:ok, p} = Process.start_link(~w(sleep 100000000), log: :stderr) # sleep indefinitely + iex> Process.await_exit(p, 1000) # ensure `await_exit` finish within `1000ms`. By default it waits for 5s {:error, :killed} # command exit due to SIGTERM ``` diff --git a/test/ex_cmd/process_test.exs b/test/ex_cmd/process_test.exs index 1ae9987..909a8a3 100644 --- a/test/ex_cmd/process_test.exs +++ b/test/ex_cmd/process_test.exs @@ -253,14 +253,14 @@ defmodule ExCmd.ProcessTest do @tag skip: Application.compile_env!(:ex_cmd, :current_os) == :windows test "await_exit with timeout" do - {:ok, s} = Process.start_link([fixture("ignore_sigterm.sh")]) + {:ok, s} = Process.start_link([fixture("ignore_sigterm.sh")], log: :stderr) {:ok, os_pid} = Process.os_pid(s) assert os_process_alive?(os_pid) assert {:ok, "ignored signals\n" <> _} = Process.read(s) - # attempt to kill the process after 200ms - assert_killed(Process.await_exit(s, 200)) + # attempt to kill the process after 1000ms + assert_killed(Process.await_exit(s, 1000)) refute os_process_alive?(os_pid) refute Elixir.Process.alive?(s.pid)