def poke(self, context):
bash_command = self.bash_command<EOL>self.log.info("<STR_LIT>", gettempdir())<EOL>with TemporaryDirectory(prefix='<STR_LIT>') as tmp_dir:<EOL><INDENT>with NamedTemporaryFile(dir=tmp_dir, prefix=self.task_id) as f:<EOL><INDENT>f.write(bytes(bash_command, '<STR_LIT>'))<EOL>f.flush()<EOL>fname = f.name<EOL>script_location = tmp_dir + "<STR_LIT:/>" + fname<EOL>self.log.info("<STR_LIT>", script_location)<EOL>self.log.info("<STR_LIT>", bash_command)<EOL>sp = Popen(<EOL>['<STR_LIT>', fname],<EOL>stdout=PIPE, stderr=STDOUT,<EOL>close_fds=True, cwd=tmp_dir,<EOL>env=self.env, preexec_fn=os.setsid)<EOL>self.sp = sp<EOL>self.log.info("<STR_LIT>")<EOL>line = '<STR_LIT>'<EOL>for line in iter(sp.stdout.readline, b'<STR_LIT>'):<EOL><INDENT>line = line.decode(self.output_encoding).strip()<EOL>self.log.info(line)<EOL><DEDENT>sp.wait()<EOL>self.log.info("<STR_LIT>", sp.returncode)<EOL>return not sp.returncode<EOL><DEDENT><DEDENT>
Execute the bash command in a temporary directory
which will be cleaned afterwards