def sudo(command: str, password: str, timeout=None): stat, out, err = common.execute('/usr/bin/sudo -S %s' % (command), '%s\n' % password, timeout, shell=True) Log.append(sudo, 'sudo', locals()) return stat, out, err
def t_event_execute(): [stat, out, err] = common.execute( path_event, env={Const.app_env: object_convert.to_json(params)}, sys_env=False, timeout=self.config.process_timeout, shell=True) Log.append( source, 'Event', { 'path': path_event, 'status': stat, 'output': out, 'error': err })
def sleep(display_only=False): common.execute( ['/usr/bin/pmset', 'displaysleepnow' if display_only else 'sleepnow'])
def exec(code: str, timeout=None): stat, out, err = common.execute('/usr/bin/osascript', code, timeout) Log.append(AppleScript.exec, 'AppleScript', locals()) return stat, out, err