Shell.py 377 字节
Newer Older
J
jiafeng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# -*- coding: utf-8 -*-
# @Time    : 2021/8/23 13:35
# @Author  : jiafeng.li
# @File    : shell.py

'''
封装执行shell语句
'''

import subprocess

class Shell:
    @staticmethod
    def invoke(cmd):
        output, errors = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
        o = output.decode("utf-8")
        return o