[Ada] Stabilize exit code on close process
Call Kill before close input handler in Close routine. Otherwise close input handler can terminate process before Kill and exit code became unpredictable. gcc/ada/ * libgnat/g-expect.adb (Close): Call Kill before Close_Input.
This commit is contained in:
parent
1e2334302d
commit
9a6f7575c1
1 changed files with 4 additions and 6 deletions
|
@ -222,6 +222,10 @@ package body GNAT.Expect is
|
|||
Next_Filter : Filter_List;
|
||||
|
||||
begin
|
||||
if Descriptor.Pid > 0 then -- see comment in Send_Signal
|
||||
Kill (Descriptor.Pid, Sig_Num => 9, Close => 0);
|
||||
end if;
|
||||
|
||||
Close_Input (Descriptor);
|
||||
|
||||
if Descriptor.Error_Fd /= Descriptor.Output_Fd
|
||||
|
@ -234,12 +238,6 @@ package body GNAT.Expect is
|
|||
Close (Descriptor.Output_Fd);
|
||||
end if;
|
||||
|
||||
-- ??? Should have timeouts for different signals
|
||||
|
||||
if Descriptor.Pid > 0 then -- see comment in Send_Signal
|
||||
Kill (Descriptor.Pid, Sig_Num => 9, Close => 0);
|
||||
end if;
|
||||
|
||||
GNAT.OS_Lib.Free (Descriptor.Buffer);
|
||||
Descriptor.Buffer_Size := 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue