MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / which

Function which

emrun.py:1137–1156  ·  view source on GitHub ↗
(program)

Source from the content-addressed store, hash-verified

1135
1136# Finds the given executable 'program' in PATH. Operates like the Unix tool 'which'.
1137def which(program):
1138 def is_exe(fpath):
1139 return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
1140
1141 fpath, fname = os.path.split(program)
1142 if fpath:
1143 if is_exe(program):
1144 return program
1145 else:
1146 exe_suffixes = ['']
1147 if WINDOWS and '.' not in fname:
1148 exe_suffixes = ['.exe', '.cmd', '.bat']
1149 for path in os.environ['PATH'].split(os.pathsep):
1150 path = path.strip('"')
1151 exe_file = os.path.join(path, program)
1152 for ext in exe_suffixes:
1153 if is_exe(exe_file + ext):
1154 return exe_file + ext
1155
1156 return None
1157
1158
1159def win_get_default_browser():

Callers 2

find_browserFunction · 0.85
runFunction · 0.85

Calls 3

is_exeFunction · 0.85
splitMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected