Options
All
  • Public
  • Public/Protected
  • All
Menu

Class InteractionHelper

A wrapper class for Driver with high level API for CLI interactions

Hierarchy

Index

Constructors

constructor

Properties

data

data: function

Type declaration

    • Parameters

      • s: string

      Returns Promise<string | false | DriverError>

Methods

clear

  • clear(): Promise<void>
  • Returns Promise<void>

commandTaking

  • commandTaking(ms: number, exitCode?: number, stdout?: string, stderr?: string): string
  • Parameters

    • ms: number
    • Optional exitCode: number
    • Optional stdout: string
    • Optional stderr: string

    Returns string

destroy

  • destroy(): void
  • Returns void

execCommandTaking

  • execCommandTaking(ms: number, exitCode?: number, stdout?: string, stderr?: string): Promise<void>
  • Parameters

    • ms: number
    • Optional exitCode: number
    • Optional stdout: string
    • Optional stderr: string

    Returns Promise<void>

getLastExitCode

  • getLastExitCode(): Promise<number>
  • Returns last process exit code or undefined if not possible. IMPORTANT: relies on $? and echo so most probably only works in unix (tested on macOs and Linux).

    This is useful on interactive applications that inquire some data and finally do some processing, in which they could fail with an excepiton. no matter if the processing takes time, we enter echo $? commands with an identifier that will be only executed after the application exits returning its exit code.

    However notice that while the app is running, althouhg not executed we are still writing to its stdin so use it when you know the app is no longer litening for relevant data, just makind final processing and exit, this is by waiting some time or in those cases where a key combination was presend to exit (q).

    TODO: example with "more" command

    Returns Promise<number>

getStrippedALlData

  • getStrippedALlData(): Promise<string>
  • Returns Promise<string>

waitForStrippedDataToInclude

  • waitForStrippedDataToInclude(s: string): Promise<string | false | DriverError>
  • Parameters

    • s: string

    Returns Promise<string | false | DriverError>

Generated using TypeDoc