+2019-12-16 Gary Dismukes <dismukes@adacore.com>
+
+ * libgnat/g-exptty.adb, libgnat/g-exptty.ads: Typo fixes and
+ minor reformatting.
+
2019-12-16 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch6.adb (Requires_Atomic_Or_Volatile_Copy): New predicate.
On_Windows : constant Boolean := Directory_Separator = '\';
-- True when on Windows
- function Waitpid (Process : System.Address; Blocking : Integer)
- return Integer;
+ function Waitpid
+ (Process : System.Address;
+ Blocking : Integer) return Integer;
pragma Import (C, Waitpid, "__gnat_tty_waitpid");
-- Wait for a specific process id, and return its exit code
------------------------
function Is_Process_Running
- (Descriptor : in out TTY_Process_Descriptor)
- return Boolean
+ (Descriptor : in out TTY_Process_Descriptor) return Boolean
is
begin
if Descriptor.Process = System.Null_Address then
end if;
Descriptor.Exit_Status := Waitpid (Descriptor.Process, Blocking => 0);
+
return Descriptor.Exit_Status = Still_Active;
end Is_Process_Running;
Status := Waitpid (Descriptor.Process, Blocking => 0);
if Status = Still_Active then
- -- In theory the process might hav died since the check. In
+ -- In theory the process might have died since the check. In
-- practice the following calls should not cause any issue.
+
Interrupt (Descriptor);
delay (0.05);
Terminate_Process (Descriptor.Process);
Status := Waitpid (Descriptor.Process, Blocking => 1);
Descriptor.Exit_Status := Status;
end if;
+
else
-- If Exit_Status is not STILL_ACTIVE just retrieve the saved
- -- exit status
+ -- exit status.
+
Status := Descriptor.Exit_Status;
end if;
function Is_Process_Running
(Descriptor : in out TTY_Process_Descriptor)
return Boolean;
- -- Return True is the process is still alive
+ -- Returns True if the process is still alive
private
Process : System.Address := System.Null_Address;
-- Underlying structure used in C
Exit_Status : Integer := Still_Active;
- -- Hold the exit status of the process.
+ -- Holds the exit status of the process
Use_Pipes : Boolean := True;
end record;