(args: Sequence[str], **kwargs)
| 29 | |
| 30 | |
| 31 | def _win_detached_subprocess(args: Sequence[str], **kwargs) -> int: |
| 32 | assert os.name == "nt" |
| 33 | |
| 34 | from subprocess import ( # type: ignore[attr-defined] |
| 35 | CREATE_NEW_PROCESS_GROUP, # ty: ignore[unresolved-import] |
| 36 | CREATE_NO_WINDOW, # ty: ignore[unresolved-import] |
| 37 | STARTF_USESHOWWINDOW, # ty: ignore[unresolved-import] |
| 38 | STARTUPINFO, # ty: ignore[unresolved-import] |
| 39 | ) |
| 40 | |
| 41 | # https://stackoverflow.com/a/7006424 |
| 42 | # https://bugs.python.org/issue41619 |
| 43 | creationflags = CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW |
| 44 | |
| 45 | startupinfo = STARTUPINFO() |
| 46 | startupinfo.dwFlags |= STARTF_USESHOWWINDOW |
| 47 | popen = subprocess.Popen( # noqa: S603 |
| 48 | args, |
| 49 | close_fds=True, |
| 50 | shell=False, |
| 51 | startupinfo=startupinfo, |
| 52 | creationflags=creationflags, |
| 53 | **kwargs, |
| 54 | ) |
| 55 | _suppress_resource_warning(popen) |
| 56 | return popen.pid |
| 57 | |
| 58 | |
| 59 | def _get_dvc_args() -> list[str]: |
no test coverage detected