NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

appUtils.py (1362B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\client\script\sys\appUtils.py
      2 import blue
      3 import carbon.client.script.util.lg as lg
      4 import bluepy
      5 from eveprefs import prefs
      6 
      7 def CanReboot():
      8     for arg in blue.pyos.GetArg()[1:]:
      9         if arg.startswith('/ssoToken'):
     10             return False
     11 
     12     return True
     13 
     14 
     15 def Reboot(reason = ''):
     16     if not CanReboot():
     17         lg.Info('appUtils.Reboot', 'suppressing reboot due to single sign-on')
     18         lg.Info('appUtils.Reboot', 'rebooting due to ' + reason)
     19         bluepy.Terminate(0, reason)
     20     lg.Info('appUtils.Reboot', 'About to reboot the client because:' + reason)
     21     prefs.SetValue('rebootReason', reason)
     22     prefs.SetValue('rebootTime', blue.os.GetWallclockTime())
     23     allargs = blue.pyos.GetArg()
     24     cmd = allargs[0]
     25     args = []
     26     for arg in allargs[1:]:
     27         arg = arg.strip()
     28         if arg.find(' ') >= 0 or arg.find('\t') >= 0:
     29             arg = '"""' + arg + '"""'
     30         args.append(arg)
     31 
     32     args = ' '.join(args)
     33     lg.Info('appUtils.Reboot', 'About to reboot the client with:' + str((0,
     34      None,
     35      cmd,
     36      args)))
     37     try:
     38         blue.os.ShellExecute(cmd, args)
     39     except Exception as e:
     40         lg.Error('appUtils.Reboot', 'Failed with: ' + str(e))
     41         raise
     42 
     43     bluepy.Terminate(0, reason)
     44 
     45 
     46 exports = {'appUtils.Reboot': Reboot}