I'd like to launch a process and send its output to tee, but the process launches a dangling child process (adb server). Start-process or just piping it in powershell end up waiting for the whole process tree, so they never terminate.
myprocess.exe | tee-object -file logfile.txt
This works, but hangs forever in powershell since myprocess exits but its child doesn't.
$child = start-process myprocess --passthru; wait-process $child
This waiting behavior is fine, but then how do I send the output to tee-object?
start-process myprocess.exe -WaitForOnlyParent | tee-object ...
This would be perfect, but it doesn't exist.