Skip to content

Conversation

nturinski
Copy link
Member

Reverts always terminating the func process introduced in this PR

I mentioned it in that PR, but if you kill the entire shell process, the terminal also gets deleted. I thought it wouldn't be that annoying, but there are times when your func process errors, and it just immediately disappears so it looks like the debug was a no-op.

I thought that there must be a better way and tried to find the real PID by looking for the port number instead. This seems to work quite a bit better.

Mac testers would be greatly appreciated.

@nturinski nturinski requested a review from a team as a code owner August 20, 2025 18:00
alexweininger
alexweininger previously approved these changes Aug 20, 2025
@alexweininger alexweininger requested a review from Copilot August 20, 2025 21:21
MicroFish91
MicroFish91 previously approved these changes Aug 20, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR reverts a previous change that always terminated the entire shell process when stopping func tasks, and implements a more targeted approach by finding the actual func process PID using port number lookup. The key motivation is to prevent terminals from being deleted when func processes error, which was causing debug sessions to appear as no-ops.

Key changes:

  • Replaces shell process termination with port-based PID lookup for killing func processes
  • Adds platform-specific implementations for finding processes by port (Windows netstat/PowerShell, Linux/Mac lsof)
  • Updates function signatures to be async where needed

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/funcCoreTools/funcHostTask.ts Implements the core logic for finding and killing func processes by port, with fallback mechanisms
src/commands/pickFuncProcess.ts Updates call to use the new async stopFuncTaskIfRunning function

@nturinski nturinski dismissed stale reviews from MicroFish91 and alexweininger via 8f6c095 August 20, 2025 21:26
@nturinski nturinski enabled auto-merge (squash) August 20, 2025 21:29
@nturinski nturinski merged commit 9a0858c into main Aug 20, 2025
2 checks passed
@nturinski nturinski deleted the nat/killByPort branch August 20, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants