Class that helps with the process of interacting with command line applications and executions through the OS terminal.
Defines the directory where the class points which will be the base path for all the executed commands. If not specified, The current system work directory will be used. Note that if we specify a work dir that is different than the main application one and linkSystemWorkDir is true, both work directories will be automatically set to the same value.
If set to true, any change that is performed on this class workDir will be reflected to the active application work dir. If set to false, this class will handle a totally independent workdir and the main application will have its own one that won't change when this class one is modified. It is true by default
A TerminalManager instance
see class constructor for docs
If this value is set, all the executed terminal commands will be appended to it. For example, if we defined baseCommand = 'copy' and we call exec('-a c:/tmp'), the effectively executed command will be 'copy -a c:/tmp'
Stores the NodeJs execSync instance
A files manager instance used by this class
Stores the NodeJs path instance
The list of workdir values that have been defined since the class was constructed. We will be able to navigate this back at any time
Create a new temporary directory on the temporary files location defined by the OS. If folder does not exist, it will be created.
When the current application exits, the folder will be automatically deleted (if possible).
see FilesManager.createTempDirectory() method
If set to true, when the new temporary folder is created it will be defined as the current active terminal working directory. It is true by default
see FilesManager.createTempDirectory() method
The full path to the newly created temporary directory
Execute an arbitrary terminal cmd command on the currently active work directory and return all relevant data
Some cmd operation to execute on the current working directory
(false by default) Set it to true to show the execution stdout in real time on the main console
An object with two properties: - failed: False if the command finished successfully, true if any error happened - output: The full terminal output that was generated by the executed command or the full error message if the execution failed
Get the directory that is currently being used by this class as the base path for commands execution
Move the current work dir to the first one that was defined when this class was created
Move the current work dir one step backward to the one that was previously defined.
Move the current terminal working directory to the specified path. If linkSystemWorkDir flag has been enabled, the main application work dir will also be pointed to the same path.
A full file system route to the location where the subsequent terminal commands will be executed
The new working directory full path
Generated using TypeDoc
TerminalManager class
constructor()