Create a subprocess for the command to run :param command: Command to run :type command: `str` :return: :rtype:
(self, command)
| 140 | return [None, True] |
| 141 | |
| 142 | def create_subprocess(self, command): |
| 143 | """Create a subprocess for the command to run |
| 144 | |
| 145 | :param command: Command to run |
| 146 | :type command: `str` |
| 147 | :return: |
| 148 | :rtype: |
| 149 | """ |
| 150 | # Add proxy settings to environment variables so that tools can pick it up proxification, because these |
| 151 | # variables are set for every command that is run |
| 152 | # http://stackoverflow.com/questions/4789837/how-to-terminate-a-python-subprocess-launched-with-shell-true/4791612#4791612) |
| 153 | proc = subprocess.Popen( |
| 154 | command, |
| 155 | shell=True, |
| 156 | env=self.shell_env, |
| 157 | preexec_fn=os.setsid, |
| 158 | stdout=subprocess.PIPE, |
| 159 | stderr=subprocess.STDOUT, |
| 160 | bufsize=1, |
| 161 | ) |
| 162 | return proc |
| 163 | |
| 164 | def shell_exec_monitor(self, session, command, plugin_info): |
| 165 | """Monitor shell command execution |