OpenSecurity/bin/cygwin.py
changeset 53 01839f13cef3
parent 52 1238895dc6b6
child 60 eeb778585a4d
     1.1 --- a/OpenSecurity/bin/cygwin.py	Mon Jan 27 15:12:33 2014 +0000
     1.2 +++ b/OpenSecurity/bin/cygwin.py	Wed Jan 29 09:23:52 2014 +0000
     1.3 @@ -67,7 +67,7 @@
     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, dos_window = False):
     1.8 +    def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, 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 @@ -76,10 +76,13 @@
    1.13          command_path = os.sep.join([Cygwin.root()] + command[0].split('/')[1:])
    1.14          command = [command_path] + command[1:]
    1.15  
    1.16 -        # with or without DOS window
    1.17 -        if not dos_window:
    1.18 -            run_command = os.sep.join([Cygwin.root()] + ['bin', 'run']) 
    1.19 -            command = [run_command] + command
    1.20 +        if not window:
    1.21 +            # hide any window
    1.22 +            shadowrun_path = os.path.join(Cygwin.root(), 'bin', 'shadowrun.exe')
    1.23 +            if os.access(shadowrun_path, os.X_OK):
    1.24 +                command = [shadowrun_path] + command
    1.25 +            else:
    1.26 +                print("EPIC FAIL!")
    1.27  
    1.28          try:
    1.29              print('cygwin: ' + ' '.join(command))