From c205175235a78af0dfa1b6b1550e8e8bc058cda0 Mon Sep 17 00:00:00 2001 From: akash-akya Date: Fri, 20 Sep 2024 14:01:40 +0530 Subject: [PATCH] Fix tests --- test/ex_cmd/process_test.exs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/ex_cmd/process_test.exs b/test/ex_cmd/process_test.exs index 61559f2..d368058 100644 --- a/test/ex_cmd/process_test.exs +++ b/test/ex_cmd/process_test.exs @@ -236,7 +236,7 @@ defmodule ExCmd.ProcessTest do assert os_process_alive?(os_pid) # ensure the script set the correct signal handlers (handlers to ignore signal) - assert {:ok, "ignored signals\n"} = Process.read(s) + assert {:ok, "ignored signals\n" <> _} = Process.read(s) # exit without waiting for the exile process {os_pid, s} @@ -271,7 +271,9 @@ defmodule ExCmd.ProcessTest do test "check command that does not take any input or produce output" do {:ok, s} = Process.start_link(["sh", "-c", "./forever.sh"]) - assert {:error, :killed} == Process.await_exit(s) + assert ret = Process.await_exit(s) + # process might die with different reason due to race condition + assert rret in [{:error, :killed}, {:ok, 127}] end test "writing binary larger than pipe buffer size" do