def asi_context(access_path): import os operating_system = system() if operating_system == "Windows": from infi.asi.win32 import OSFile, Win32CommandExecuter handle = OSFile(access_path) executer = Win32CommandExecuter(handle) else: from infi.asi.unix import OSFile handle = OSFile(os.open(access_path, os.O_RDWR)) if operating_system == "SunOS": from infi.asi.solaris import SolarisCommandExecuter executer = SolarisCommandExecuter(handle) elif operating_system == "linux": from infi.asi.linux import LinuxIoctlCommandExecuter executer = LinuxIoctlCommandExecuter(handle) try: yield executer finally: handle.close()
def asi_context(self): from infi.asi.win32 import OSFile from infi.asi import create_platform_command_executer handle = OSFile(self.get_pdo()) executer = create_platform_command_executer(handle) try: yield executer finally: handle.close()
def asi_context(access_path): import os operating_system = system() if operating_system == 'Windows': from infi.asi.win32 import OSFile, Win32CommandExecuter handle = OSFile(access_path) executer = Win32CommandExecuter(handle) else: from infi.asi.unix import OSFile handle = OSFile(os.open(access_path, os.O_RDWR)) if operating_system == 'SunOS': from infi.asi.solaris import SolarisCommandExecuter executer = SolarisCommandExecuter(handle) elif operating_system == 'linux': from infi.asi.linux import LinuxIoctlCommandExecuter executer = LinuxIoctlCommandExecuter(handle) try: yield executer finally: handle.close()