Find an executable tmp directory.
()
| 44 | |
| 45 | |
| 46 | def _get_tmp(): |
| 47 | """Find an executable tmp directory.""" |
| 48 | userdir = Path("~").expanduser() |
| 49 | for testdir in [ |
| 50 | tempfile.gettempdir(), |
| 51 | str(userdir / ".cache"), |
| 52 | str(userdir / ".tmp"), |
| 53 | str(userdir), |
| 54 | ]: |
| 55 | if ( |
| 56 | not Path(testdir).exists() |
| 57 | or _run_shell_command("echo success", testdir) != "success" |
| 58 | ): |
| 59 | continue |
| 60 | return testdir |
| 61 | return "" |
| 62 | |
| 63 | |
| 64 | class ShellCode(NoneditableTextObject): |
no test coverage detected