microsoft / microsoft/terminal
Process.CloseMainWindow() and Process.Close() are ignored for processes running in terminal
@zadjii-msft is already working on this.
Since Jan 6, 2023.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
### Windows Terminal version
1.11.2921.0
### Windows build number
10.0.22000.258
### Other Software
.NET Framework 4.7.1
### Steps to reproduce
Configure Terminal as default terminal application.
Write application (in our case .NET framework 4.7.1 WPF application) that starts some other console process:
`var startInfo = new ProcessStartInfo {
UseShellExecute = false
};
var process = new Process {
EnableRaisingEvents = true,
StartInfo = startInfo
};
process.Start();`
then try to stop this process with the following code:
`Process process = Process.GetProcessById(processId);
if (!process.HasExited) {
process.CloseMainWindow();
if (!process.HasExited) {
if (!process.WaitForExit(5000)) {
process.Close();
}
}
}`
### Expected Behavior
Process is stopped and the terminal tab is closed (same as in the case cmd.exe is the default terminal application).
### Actual Behavior
Nothing happens.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.