import os import subprocess import shlex def shell_exec(command): p = subprocess.Popen(shlex.split(command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True).communicate() return p[0].decode("utf-8", errors="ignore") try: print(shell_exec("npm run build")) except Exception as e: print(e) #print(shell_exec("rsync -avhp --rsync-path=\"sudo rsync\" --chmod=a=rwX build/ steam@hvh.tf:/var/www/html/"))