| 1 |
-- { dg-do run } |
| 2 |
|
| 3 |
with Ada.Text_IO; |
| 4 |
|
| 5 |
with GNAT.Expect.TTY; |
| 6 |
with GNAT.OS_Lib; |
| 7 |
|
| 8 |
procedure Expect3 is |
| 9 |
Pid : GNAT.Expect.TTY.TTY_Process_Descriptor; |
| 10 |
Args : GNAT.OS_Lib.Argument_List (1 .. 0); |
| 11 |
Result : GNAT.Expect.Expect_Match; |
| 12 |
|
| 13 |
begin |
| 14 |
Pid.Non_Blocking_Spawn ("true", Args); |
| 15 |
|
| 16 |
begin |
| 17 |
Pid.Expect (Result, ".*"); |
| 18 |
|
| 19 |
raise Program_Error; |
| 20 |
|
| 21 |
exception |
| 22 |
when GNAT.Expect.Process_Died => |
| 23 |
declare |
| 24 |
File : Ada.Text_IO.File_Type; |
| 25 |
|
| 26 |
begin |
| 27 |
Ada.Text_IO.Create (File); |
| 28 |
Pid.Close; |
| 29 |
Ada.Text_IO.Put_Line (File, "Test of write operation"); |
| 30 |
Ada.Text_IO.Close (File); |
| 31 |
end; |
| 32 |
end; |
| 33 |
end Expect3; |