def swift_build()

in core/swift53Action/swiftbuild.py [0:0]


def swift_build(dir, buildcmd):
    # compile...
    env = {
      "PATH": os.environ["PATH"]
    }
    p = subprocess.Popen(buildcmd,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        cwd=dir,
        env=env)
    (o, e) = p.communicate()
    # stdout/stderr may be either text or bytes, depending on Python
    # version, so if bytes, decode to text. Note that in Python 2
    # a string will match both types; so also skip decoding in that case
    if isinstance(o, bytes) and not isinstance(o, str):
        o = o.decode('utf-8')
    if isinstance(e, bytes) and not isinstance(e, str):
        e = e.decode('utf-8')
    return p.returncode, o, e