Tag: spawn

C#检测产生的进程

我正在编写一段c#代码,用于启动安装程序并在继续使用其他内容之前等待它返回。 我遇到某些安装程序出现问题,这些安装程序在安装实际完成之前返回原始进程的其他进程。 有什么方法可以等到所有流程完成后? 为了澄清这里我遇到麻烦的情况: 启动Installer1 Installer1生成/启动另一个安装程序(Installer2) 安装程序1返回 应用程序认为安装已完成但Installer2仍在运行。 这会导致应用程序中的工作流问题。 这是我目前正在使用的代码: // launch installer Process process = windowsApplicationLauncher.LaunchApplication(_localFilePath); // wait for process to return do { if (!process.HasExited) { } } while (!process.WaitForExit(1000)); if (process.ExitCode == 0) { _fileService.MoveFile(_localFilePath, _postInstallFilePath); _notification.SetComplete(false); return true; } return false;