You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -35,6 +36,10 @@ Optional arguments enable the collection of standard output and error streams, a
35
36
36
37
`want_stderr` (optional): Shall be a logical flag. If `.true.`, the standard error output of the process will be captured. Default: `.false.`. This is an `intent(in)` argument.
37
38
39
+
`callback` (optional): Shall be a procedure conforming to the `process_callback` interface. If present, this function will be called upon process completion with the process ID, exit state, and optionally collected standard input, output, and error streams. This is an `intent(in)` argument.
40
+
41
+
`payload` (optional): Shall be a generic (`class(*)`) scalar that will be passed to the callback function upon process completion. It allows users to associate custom data with the process execution. This is an `intent(inout), target` argument.
42
+
38
43
### Return Value
39
44
40
45
Returns an object of type `process_type` that contains information about the state of the created process.
@@ -49,7 +54,6 @@ type(process_type) :: p
49
54
p = run("echo 'Hello, world!'", want_stdout=.true.)
50
55
```
51
56
52
-
53
57
## `runasync` - Execute an external process asynchronously
54
58
55
59
### Status
@@ -61,10 +65,11 @@ Experimental
61
65
The `runasync` interface allows execution of external processes using a single command string or a list of arguments.
62
66
Processes are run asynchronously (non-blocking), meaning execution does not wait for the process to finish.
63
67
Optional arguments enable the collection of standard output and error streams, as well as sending input via standard input.
68
+
Additionally, a callback function can be specified to execute upon process completion, optionally receiving a user-defined payload.
@@ -76,6 +81,10 @@ Optional arguments enable the collection of standard output and error streams, a
76
81
77
82
`want_stderr` (optional): Shall be a logical flag. If `.true.`, the standard error output of the process will be captured. Default: `.false.`. This is an `intent(in)` argument.
78
83
84
+
`callback` (optional): Shall be a procedure conforming to the `process_callback` interface. If present, this function will be called upon process completion with the process ID, exit state, and optionally collected standard input, output, and error streams. This is an `intent(in)` argument.
85
+
86
+
`payload` (optional): Shall be a generic (`class(*)`) scalar that will be passed to the callback function upon process completion. It allows users to associate custom data with the process execution. This is an `intent(inout), target` argument.
87
+
79
88
### Return Value
80
89
81
90
Returns an object of type `process_type` that contains information about the state of the created process.
0 commit comments