2017-12-11 22:46:26 +00:00
|
|
|
#! /usr/bin/env python2
|
|
|
|
# Copyright 2017 Google Inc.
|
|
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
|
|
# found in the LICENSE file.
|
|
|
|
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2019-04-19 18:38:59 +00:00
|
|
|
def spawn(cmd):
|
|
|
|
with open(os.devnull, 'w') as o:
|
|
|
|
subprocess.Popen(cmd, stdout=o, stderr=o)
|
|
|
|
|
2017-12-11 22:46:26 +00:00
|
|
|
def sysopen(arg):
|
|
|
|
plat = sys.platform
|
|
|
|
if plat.startswith('darwin'):
|
2019-04-19 18:38:59 +00:00
|
|
|
spawn(["open", arg])
|
2017-12-11 22:46:26 +00:00
|
|
|
elif plat.startswith('win'):
|
|
|
|
os.startfile(arg)
|
|
|
|
else:
|
2019-04-19 18:38:59 +00:00
|
|
|
spawn(["xdg-open", arg])
|
2017-12-11 22:46:26 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
for a in sys.argv[1:]:
|
|
|
|
sysopen(a)
|