(self, filepath, variables)
| 35 | fout.write(line) |
| 36 | |
| 37 | def run_sample(self, filepath, variables): |
| 38 | inpath = os.path.join(cwd, "..", "..", "docs", "examples", filepath) |
| 39 | outpath = os.path.join(cwd, "tmp_{}".format(filepath)) |
| 40 | self.replaceVariables(inpath, outpath, variables) |
| 41 | |
| 42 | self.proc = subprocess.Popen( |
| 43 | [shutil.which("python"), |
| 44 | outpath], |
| 45 | text=True, bufsize=1, |
| 46 | stdin=subprocess.PIPE, |
| 47 | stdout=subprocess.PIPE |
| 48 | ) |
| 49 | |
| 50 | def write(self, string): |
| 51 | self.proc.stdin.write(string) |