Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
run.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2
3# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
4# for details. All rights reserved. Use of this source code is governed by a
5# BSD-style license that can be found in the LICENSE file.
6
7# Runs rust tools, overriding the PATH variable so they can locate each other.
8
9import os
10import subprocess
11import sys
12import time
13
14def run(cmd):
15 bindir = os.path.dirname(cmd[0]);
16 env = os.environ
17 if 'PATH' in env:
18 env['PATH'] += os.pathsep + bindir
19 else:
20 env['PATH'] = bindir
21 out = ''
22 err = ''
23 proc = subprocess.Popen(
24 cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
25 while proc.returncode is None:
26 time.sleep(1)
27 stdout, stderr = proc.communicate()
28 out += stdout
29 err += stderr
30 proc.poll()
31 if proc.returncode == 0:
32 return 0
33 print(out)
34 print(err)
35 return proc.returncode
36
37if __name__ == '__main__':
38 sys.exit(run(sys.argv[1:]))
void print(void *str)
Definition bridge.cpp:126
Definition run.py:1