Skip to content

Commit 8656f5a

Browse files
[releases/1.2] Fix the discovery service to not terminate on parent process closure (#391)
* Add DETACHED_PROCESS flag to detach the discovery process from its parent console process * Fix test failure --------- Co-authored-by: Joel Dixon <38357562+dixonjoel@users.noreply.github.com>
1 parent a9d542d commit 8656f5a

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

ni_measurementlink_service/_internal/discovery_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def _start_service(
268268
kwargs: Dict[str, Any] = {}
269269
if sys.platform == "win32":
270270
# Terminating the measurement service should not terminate the discovery service.
271-
kwargs["creationflags"] = subprocess.CREATE_BREAKAWAY_FROM_JOB
271+
kwargs["creationflags"] = subprocess.CREATE_BREAKAWAY_FROM_JOB | subprocess.DETACHED_PROCESS
272272
discovery_service_subprocess = subprocess.Popen(
273273
[exe_file_path],
274274
cwd=exe_file_path.parent,

tests/unit/test_discovery_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def test___discovery_service_exe_unavailable___register_service___raises_file_no
193193
def subprocess_popen_kwargs() -> Dict[str, Any]:
194194
kwargs: Dict[str, Any] = {}
195195
if sys.platform == "win32":
196-
kwargs["creationflags"] = subprocess.CREATE_BREAKAWAY_FROM_JOB
196+
kwargs["creationflags"] = subprocess.CREATE_BREAKAWAY_FROM_JOB | subprocess.DETACHED_PROCESS
197197
return kwargs
198198

199199

0 commit comments

Comments
 (0)