Send a command and return immediately. This is a lower level method than cmd(). This method will instruct the cmd-runner process to execute a command, but this method will immediately return. You will need to use ``is_cmd_finished()`` to check that the comma
(self, *cmd)
| 241 | self._popen.wait() |
| 242 | |
| 243 | def send_cmd(self, *cmd): |
| 244 | """Send a command and return immediately. |
| 245 | |
| 246 | This is a lower level method than cmd(). |
| 247 | This method will instruct the cmd-runner process |
| 248 | to execute a command, but this method will |
| 249 | immediately return. You will need to use |
| 250 | ``is_cmd_finished()`` to check that the command |
| 251 | is finished. |
| 252 | |
| 253 | This method is useful if you want to record attributes |
| 254 | about the process while an operation is occurring. For |
| 255 | example, if you want to instruct the cmd-runner process |
| 256 | to upload a 1GB file to S3 and you'd like to record |
| 257 | the memory during the upload process, you can use |
| 258 | send_cmd() instead of cmd(). |
| 259 | |
| 260 | """ |
| 261 | cmd_str = ' '.join(cmd) + '\n' |
| 262 | cmd_bytes = cmd_str.encode('utf-8') |
| 263 | self._popen.stdin.write(cmd_bytes) |
| 264 | self._popen.stdin.flush() |
| 265 | |
| 266 | def is_cmd_finished(self): |
| 267 | rlist = [self._popen.stdout.fileno()] |