()
| 271 | |
| 272 | |
| 273 | def restart_with_reloader(): |
| 274 | new_environ = {**os.environ, DJANGO_AUTORELOAD_ENV: "true"} |
| 275 | orig = getattr(sys, "orig_argv", ()) |
| 276 | if any( |
| 277 | (arg == "-u") |
| 278 | or ( |
| 279 | arg.startswith("-") |
| 280 | and not arg.startswith(("--", "-X", "-W")) |
| 281 | and len(arg) > 2 |
| 282 | and arg[1:].isalpha() |
| 283 | and "u" in arg |
| 284 | ) |
| 285 | for arg in orig[1:] |
| 286 | ): |
| 287 | new_environ.setdefault("PYTHONUNBUFFERED", "1") |
| 288 | args = get_child_arguments() |
| 289 | while True: |
| 290 | p = subprocess.run(args, env=new_environ, close_fds=False) |
| 291 | if p.returncode != 3: |
| 292 | return p.returncode |
| 293 | |
| 294 | |
| 295 | class BaseReloader: |
no test coverage detected