Commit 938ddf74 by Enrico Pozzobon

middleware stub for uno

parent 726359a5
#!/usr/bin/env python3
import os
import sys
import subprocess
def flash():
pipe = subprocess.PIPE
p = subprocess.Popen(['platformio', 'run', '-e', 'uno', '--target', 'upload'],
stdout=sys.stderr, stdin=pipe)
stdout, stderr = p.communicate("")
def main(argv):
print(argv[0], file=sys.stderr)
script_dir = os.path.split(argv[0])[0]
if len(script_dir) > 0:
os.chdir(script_dir)
flash()
return 0;
if __name__ == "__main__":
sys.exit(main(sys.argv))
......@@ -23,6 +23,9 @@ def main(argv):
def read(l):
data = p.stdout.read(l)
if len(data) == 0:
print("Unexpected end of stream", file=sys.stderr)
sys.exit(1)
if len(data) != l:
raise Exception("could not read %d bytes of data (got %d)" % (l, len(data)))
return data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment