mylinux.model.linux package

Submodules

mylinux.model.linux.Executor module

class mylinux.model.linux.Executor.Executor[source]

Main model terminal executor.

This class handles shell bash executing, returning stdout/stderr etc...

Variables:
  • __errorsCount (int) – Count errors.
  • __executeCount (int) – Count how many command was executed.
  • __status (int) – Holding status variables for user visualization of the progress.
_Executor__display(line)

Print display line of executing info.

Parameters:line (str) – What string should be showed to the user when there is active subprocess.
_Executor__getStatusLine()

Format and return status line to be showed.

Returns:Pretty status line
_Executor__supportedCmdArray(cmdArray)
errorsCount
Returns:__errorsCount
execute(cmdArray)[source]

Main executing method for shell executing.

Parameters:

cmdArray (arr-str) – Commands to be executed in shell.

Returns:

[Pass (boo), stdout, stderr]

Other Parameters:
 
  • Add 1 to the __executeCount variable.
  • Update status with cmd string.
  • Make new processs for cmdArray and pipe stdout/stderr.
  • Check for user interupts (KeyboardInterrupt,SystemExit).
  • Check if error has been caught, if tru raise __errorsCount variable
  • Display stdout/stderr line.
  • Check for exit code
  • Close process.
executeArrays(cmdArrays)[source]

Wraper around execute method.

Parameters:

cmdArrays (arr-arr-str) – Command arrays that must be executed.

Returns:

[Pass (boo),stdoutAll,stderrAll]

Other Parameters:
 
  • Execute array
  • Fill stdout/stderr with data
executeCount
Returns:__executeCount
exit
status
Returns:__status

Module contents

Other Parameters:
 
  • module_Executor (mod)
  • Executor (cls)