示例#1
0
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
示例#2
0
 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
         })
示例#3
0
def sleep(display_only=False):
    common.execute(
        ['/usr/bin/pmset', 'displaysleepnow' if display_only else 'sleepnow'])
示例#4
0
 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