@@ -11,6 +11,8 @@ module stdlib_system
11
11
public :: process_type
12
12
public :: is_completed
13
13
public :: is_running
14
+ public :: update
15
+ public :: wait
14
16
15
17
! CPU clock ticks storage
16
18
integer , parameter , private :: TICKS = int64
@@ -33,9 +35,6 @@ module stdlib_system
33
35
logical :: completed = .false.
34
36
integer (TICKS) :: start_time = 0
35
37
36
- ! > Process exit code
37
- integer :: exit_code = 0
38
-
39
38
! > Stdin file name
40
39
character (:), allocatable :: stdin_file
41
40
@@ -44,6 +43,7 @@ module stdlib_system
44
43
character (:), allocatable :: stdout
45
44
46
45
! > Error output
46
+ integer :: exit_code = 0
47
47
character (:), allocatable :: stderr_file
48
48
character (:), allocatable :: stderr
49
49
@@ -53,8 +53,19 @@ module stdlib_system
53
53
end type process_type
54
54
55
55
interface run
56
- ! > Open a new, asynchronous process
57
- module type (process_type) function process_open(args,wait,stdin,want_stdout,want_stderr) result(process)
56
+ ! > Open a new process from a command line
57
+ module type (process_type) function process_open_cmd(cmd,wait,stdin,want_stdout,want_stderr) result(process)
58
+ ! > The command and arguments
59
+ character (* ), intent (in ) :: cmd
60
+ ! > Optional character input to be sent to the process via pipe
61
+ character (* ), optional , intent (in ) :: stdin
62
+ ! > Define if the process should be synchronous (wait=.true.), or asynchronous(wait=.false.)
63
+ logical , optional , intent (in ) :: wait
64
+ ! > Require collecting output
65
+ logical , optional , intent (in ) :: want_stdout, want_stderr
66
+ end function process_open_cmd
67
+ ! > Open a new, asynchronous process from a list of arguments
68
+ module type (process_type) function process_open_args(args,wait,stdin,want_stdout,want_stderr) result(process)
58
69
! > The command and arguments
59
70
character (* ), intent (in ) :: args(:)
60
71
! > Optional character input to be sent to the process via pipe
@@ -63,7 +74,7 @@ module type(process_type) function process_open(args,wait,stdin,want_stdout,want
63
74
logical , optional , intent (in ) :: wait
64
75
! > Require collecting output
65
76
logical , optional , intent (in ) :: want_stdout, want_stderr
66
- end function process_open
77
+ end function process_open_args
67
78
end interface run
68
79
69
80
! > Live check if a process is still running
@@ -101,7 +112,7 @@ end subroutine wait_for_completion
101
112
module subroutine update_process_state (process )
102
113
type (process_type), intent (inout ) :: process
103
114
end subroutine update_process_state
104
- end interface
115
+ end interface update
105
116
106
117
! ! version: experimental
107
118
! !
0 commit comments