8.8.1.1.2.2.4. Cio

class Cio
beginCapture(fullPath, append=None) None

Start capturing stdout and stderr from the target program (e.g. printf) to specified file.

# overwrite file if it already exists
session.cio.beginCapture("C:/capturedOutput.txt")
session.cio.beginCapture("C:/capturedOutput.txt", False)

# append to file if it already exists
session.cio.beginCapture("C:/capturedOutput.txt", True)
Parameters:
  • fullPath (str) -- The full path to the file to which stdout and stderr are to be captured.

  • append (bool) -- (optional) Whether to append to the file instead of overwriting it (default: false).

Return type:

None

endCapture() None

Stop capturing to the file.

session.cio.endCapture()
Return type:

None

getLastStdErr() str

Get the latest buffered standard error text as a string.

lastStdErr = session.cio.getLastStdErr()
print(f"Last standard error: {lastStdErr}")
Returns:

The latest buffered standard error.

Return type:

str

getLastStdOut() str

Returns the latest buffered standard output text as a string.

lastStdOut = session.cio.getLastStdOut()
print(f"Last standard output: {lastStdOut}")
Returns:

The latest buffered standard output.

Return type:

str