MySQL Shell API 8.0.37
Unified development interface for MySQL Products
Methods | Properties | List of all members
Os Class Reference

Gives access to functions which allow to interact with the operating system. More...

Methods

String getcwd ()
 Retrieves the absolute path of the current working directory. More...
 
String getenv (String name)
 Retrieves the value of the specified environment variable. More...
 
String loadTextFile (String path)
 Reads the contents of a text file. More...
 
Undefined sleep (Number seconds)
 Stops the execution for the given number of seconds. More...
 
Bool file_exists (String path)
 Checks if the given path exists and is a file. More...
 
String get_binary_folder ()
 Provides the path to the folder which contains the binary of shell. More...
 
String get_mysqlx_home_path ()
 Provides the path to the home folder for the shell. More...
 
String get_user_config_path ()
 Provides the path to the shell configuration folder. More...
 
String load_text_file (String path)
 Reads the contents of a text file. More...
 

Properties

Path path
 Gives access to path-related functions.
 

Detailed Description

Gives access to functions which allow to interact with the operating system.

Member Function Documentation

◆ getcwd()

String getcwd ( )

Retrieves the absolute path of the current working directory.

Returns
The absolute path of the current working directory.

◆ getenv()

String getenv ( String  name)

Retrieves the value of the specified environment variable.

Parameters
nameThe name of the environment variable.
Returns
The value of environment variable, or null if given variable does not exist.

◆ loadTextFile()

String loadTextFile ( String  path)

Reads the contents of a text file.

Parameters
pathThe path to the file to be read.
Returns
The contents of the text file.
Exceptions
RuntimeErrorIf the specified file does not exist.

◆ sleep()

Undefined sleep ( Number  seconds)

Stops the execution for the given number of seconds.

Parameters
secondsThe number of seconds to sleep for.

◆ file_exists()

Bool file_exists ( String  path)

Checks if the given path exists and is a file.

Parameters
pathA file-system path.
Returns
true if path points to an existing file.
Attention
This function will be removed in a future release, use the os.path.isfile() function instead.

◆ get_binary_folder()

String get_binary_folder ( )

Provides the path to the folder which contains the binary of shell.

Returns
The path to the folder which contains the binary of shell.
Attention
This function will be removed in a future release.

◆ get_mysqlx_home_path()

String get_mysqlx_home_path ( )

Provides the path to the home folder for the shell.

Returns
The path to the home folder for the shell.
Attention
This function will be removed in a future release.

◆ get_user_config_path()

String get_user_config_path ( )

Provides the path to the shell configuration folder.

Returns
The path to the shell configuration folder.
Attention
This function will be removed in a future release.

◆ load_text_file()

String load_text_file ( String  path)

Reads the contents of a text file.

Parameters
pathThe path to the file to be read.
Returns
The contents of the text file.
Attention
This function will be removed in a future release, use the loadTextFile() function instead.
Exceptions
RuntimeErrorIf the specified file does not exist.