Function Reference

StdioClose

Closes all resources associated with a process previously run with STDIO redirection.

StdioClose ( process_id )

 

Parameters

process_id The process ID of a child process, as returned by a previous call to Run.

 

Return Value

Success: Non-zero.
Failure: 0 if the process did not have STDIO redirection or was already closed.

 

Remarks

This function closes all handles and releases all resources related to STDIO. It will no longer be possible to read the STDIO data from the process. Any pending data will be lost.

 

Related

StdoutRead, StderrRead, StdinWrite, Run, RunAs

 

Example


; Demonstrates StdioClose()
#include <Constants.au3>

Local $pid = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
StdioClose($pid)

; No data will be read because we closed all the streams we would read from.
Local $line
While 1
    $line = StdoutRead($pid)
    If @error Then ExitLoop
    MsgBox(0, "STDOUT read:", $line)
Wend

While 1
    $line = StderrRead($pid)
    If @error Then ExitLoop
    MsgBox(0, "STDERR read:", $line)
Wend

MsgBox(0, "Debug", "Exiting...")