File: ProcessLauncher.py

package info (click to toggle)
kissplice 2.6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,752 kB
  • sloc: cpp: 8,783; python: 1,618; perl: 389; sh: 72; makefile: 18
file content (17 lines) | stat: -rw-r--r-- 410 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/python3
from sys import exit
import shutil
import shlex
from subprocess import Popen, PIPE, STDOUT


def run(command_line, shell=False):
    print(command_line)
    args = shlex.split(command_line)
    command = Popen(args, stdout=PIPE, stderr=PIPE)
    res = command.communicate()
    if len(res[1]):
        print("Integration test error : ",res[1])
        exit()
    else:
        return res[0]