python启动vscode

#!/bin/env python
#coding=utf-8
import os
import sys
import subprocess
import commands 

def checkUserIsROOTCommandline():
    if os.geteuid() != 0:
       print "This program must be run as root. Aborting."
       return False
       sys.exit(1)
    else:
       return True 

def startVSCodeIDE():
    rc,out = commands.getstatusoutput("code --user-data-dir=/home/config/Code/")
      #print ("VSCode Starting:\033[0;31m%s\033[0m" % out)
      #print ("VSCode Starting:\033[1;32m%s\033[0m" % "out")

def main():
    if True==checkUserIsROOTCommandline():
     # print checkUserIsROOTCommandline()
      startVSCodeIDE()

if __name__ == '__main__':
    main()

 

你可能感兴趣的:(python启动vscode)