1#! /usr/bin/env python2 2# Copyright 2017 Google Inc. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import os 7import subprocess 8import sys 9 10def spawn(cmd): 11 with open(os.devnull, 'w') as o: 12 subprocess.Popen(cmd, stdout=o, stderr=o) 13 14def sysopen(arg): 15 plat = sys.platform 16 if plat.startswith('darwin'): 17 spawn(["open", arg]) 18 elif plat.startswith('win'): 19 os.startfile(arg) 20 else: 21 spawn(["xdg-open", arg]) 22 23if __name__ == '__main__': 24 for a in sys.argv[1:]: 25 sysopen(a) 26