8.8.1.1.1.2.4. Cio

interface Cio()
beginCapture(fullPath: string, append?: boolean)

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 (string) -- The full path to the file to which stdout and stderr are to be captured.

  • append (boolean | null) -- Whether to append to the file instead of overwriting it (default: false).

Return type:

void

endCapture()

Stop capturing to the file.

session.cio.endCapture();
Return type:

void

getLastStdErr()

Get the latest buffered standard error text as a string.

const lastStdErr = session.cio.getLastStdErr();
console.log(`Last standard error: ${lastStdErr}`);
Returns:

The latest buffered standard error.

Return type:

string

getLastStdOut()

Returns the latest buffered standard output text as a string.

const lastStdOut = session.cio.getLastStdOut();
console.log(`Last standard output: ${lastStdOut}`);
Returns:

The latest buffered standard output.

Return type:

string