1.1 --- a/OpenSecurity/bin/cygwin.py Thu Jan 23 16:31:33 2014 +0000
1.2 +++ b/OpenSecurity/bin/cygwin.py Mon Jan 27 15:12:33 2014 +0000
1.3 @@ -67,19 +67,25 @@
1.4 return path_valid[0]
1.5
1.6
1.7 - def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE):
1.8 + def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, dos_window = False):
1.9 """execute a cygwin shell command
1.10
1.11 command is list of arguments like ['/bin/ls', '-al', '-h']
1.12
1.13 a Popen object is returned"""
1.14 - command_path = Cygwin.root() + os.sep.join(command[0].split('/'))
1.15 + command_path = os.sep.join([Cygwin.root()] + command[0].split('/')[1:])
1.16 command = [command_path] + command[1:]
1.17 -
1.18 +
1.19 + # with or without DOS window
1.20 + if not dos_window:
1.21 + run_command = os.sep.join([Cygwin.root()] + ['bin', 'run'])
1.22 + command = [run_command] + command
1.23 +
1.24 try:
1.25 + print('cygwin: ' + ' '.join(command))
1.26 return subprocess.Popen(command, shell = False, stdin = stdin, stdout = stdout, stderr = stderr)
1.27 except:
1.28 - sys.stderr.writeln('Failed to execute cygwin command.\n\tcommand="' + command + '"')
1.29 + sys.stderr.write('Failed to execute cygwin command.\n\tcommand="' + ' '.join(command) + '"\n')
1.30
1.31
1.32 @staticmethod