HEX
Server: LiteSpeed
System: Linux CentOS-79-64-minimal 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: vishn3436 (5293)
PHP: 8.0.15
Disabled: NONE
Upload Files
File: //scripts/script-server/src/utils/os_utils.py
import os

os_name = os.name
path_separator = os.path.sep


def is_win():
    global os_name
    return os_name == 'nt'


def is_linux():
    global os_name
    return os_name == 'posix'


def is_mac():
    global os_name
    return os_name == 'mac'


def path_sep():
    global path_separator
    return path_separator


def is_pty_supported():
    return is_linux()


# THIS SHOULD BE USED IN TESTS ONLY!
def reset_os():
    global os_name
    global path_separator

    os_name = os.name
    path_separator = os.path.sep


def set_win():
    global os_name
    global path_separator
    os_name = 'nt'
    path_separator = '\\'


def set_linux():
    global os_name
    global path_separator
    os_name = 'posix'
    path_separator = '/'


def set_mac():
    global os_name
    global path_separator
    os_name = 'mac'
    path_separator = '/'