return (self.pattern == other.pattern)
- def resolve(self):
+ def resolve(self, cwd):
import glob
- results = glob.glob(self.pattern)
+ import os
+ if os.path.isabs(self.pattern):
+ abspath = self.pattern
+ else:
+ abspath = os.path.join(cwd, self.pattern)
+ results = glob.glob(abspath)
return [self.pattern] if len(results) == 0 else results
class Pipeline:
return (finalExitCode, timeoutInfo)
-def expand_glob(arg):
+def expand_glob(arg, cwd):
if isinstance(arg, GlobItem):
- return arg.resolve()
+ return arg.resolve(cwd)
return [arg]
-def expand_glob_expressions(args):
+def expand_glob_expressions(args, cwd):
result = [args[0]]
for arg in args[1:]:
- result.extend(expand_glob(arg))
+ result.extend(expand_glob(arg, cwd))
return result
def quote_windows_command(seq):
else:
if r[2] is None:
redir_filename = None
- name = expand_glob(r[0])
+ name = expand_glob(r[0], cmd_shenv.cwd)
if len(name) != 1:
raise InternalShellError(j,"Unsupported: glob in redirect expanded to multiple files")
name = name[0]
args[i] = f.name
# Expand all glob expressions
- args = expand_glob_expressions(args)
+ args = expand_glob_expressions(args, cmd_shenv.cwd)
# On Windows, do our own command line quoting for better compatibility
# with some core utility distributions.