Module for basic subprocess management on Unix. Procedures with
name postfix 2
are for bi-directional IPC, all other for
uni-directional only.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public, | parameter | :: | PIPE_RDONLY | = | 1 |
Read-only access. |
integer, | public, | parameter | :: | PIPE_WRONLY | = | 2 |
Write-only access. |
Opaque pipe type. Stores the C pointer of uni-directional pipe.
Returns .true.
if pipe is connected.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pipe_type), | intent(inout) | :: | pipe |
Pipe type. |
Opens a process by creating a pipe, forking, and invoking the shell.
Access mode has to be either PIPE_RDONLY
or PIPE_WRONLY
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pipe_type), | intent(inout) | :: | pipe |
Pipe type. |
||
character(len=*), | intent(in) | :: | command |
Name or path of binary to open. |
||
integer, | intent(in) | :: | access |
Open pipe for reading or writing. |
Creates three anonymous pipes for bidirectional IPC (stdin
,
stdout
, stderr
).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pipe_type), | intent(out) | :: | stdin |
Standard input handle. |
||
type(pipe_type), | intent(out) | :: | stdout |
Standard output handle. |
||
type(pipe_type), | intent(out) | :: | stderr |
Standard error handle. |
||
character(len=*), | intent(in) | :: | command |
Program to invoke. |
Reads from pipe to buffer bytes
(binary) and returns number of
bytes written to buffer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pipe_type), | intent(inout) | :: | pipe |
Bi-directional pipe. |
||
character(len=*), | intent(inout), | target | :: | bytes |
Output buffer. |
Writes to pipe. Trims the string, adds new line and null-termination.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pipe_type), | intent(inout) | :: | pipe |
Pipe type. |
||
character(len=*), | intent(in) | :: | str |
String to write to the pipe. |
Writes to pipe (binary) and returns the number of bytes written.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pipe_type), | intent(inout) | :: | pipe |
Bi-directional pipe. |
||
character(len=*), | intent(in), | target | :: | bytes |
Bytes to write to the pipe. |
Closes pipe to process.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pipe_type), | intent(inout) | :: | pipe |
Pipe type. |
Closes pipe to process (binary).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(pipe_type), | intent(inout) | :: | pipe |
Pipe type. |