Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Fixed to return the correct pid for the selected container #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fixed to return the correct pid for the selected container #3

wants to merge 1 commit into from

Conversation

RodrigoTHD
Copy link

Hi @Dreamescaper,

I fixed the issue #1 exec -it {containerName} pidof dotnet is returning multiples PIDs

This is the right cli command to get the process id:

docker exec -it CONTAINER_NAME pidof DOT_NET_PROJECT_NAME

One suggestion, we can improve the quality of the project adding some tests.

Best regards,

Rolf Rodrigo Krueger

@Dreamescaper
Copy link
Owner

Thanks for contribution!
Will take a look a bit later, probably on the weekend.

One suggestion, we can improve the quality of the project adding some tests.

True, but I'm not sure about future of this extension, considering that VS has built-in support for debugging inside docker containers now (see #2 ).

@RodrigoTHD
Copy link
Author

Thanks for the answer!

I already did some tests in the official option. works very well, but it is slower than this one.

In my opinion, this one is still useful. In addition to being faster, it selects the correct process id automatically.

@Dreamescaper
Copy link
Owner

I tested it, and it doesn't work for me.
docker exec -it {containerName} pidof dotnet returns 1,
docker exec -it {containerName} pidof {projectName} returns nothing.

Why do you expect that to work?

Other question - what issue are you actually fixing?
Original #1 is actually fixed, the only remaining request was to add some additional info to differentiate between process ids, if multiple present.

@RodrigoTHD
Copy link
Author

Hi,
It doesn't work for me using any pid from pidof dotnet.

Environment details:

  • Linux container
  • docker image: mcr.microsoft.com/dotnet/core/sdk:3.1.201-buster.
  • Install VSDBG by running the following command: curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l /vsdbg && \

In my environment, the following commands return the PIDs:

docker exec -it {containerName} pidof {projectName} returns 197.
docker exec -it {containerName} pidof dotnet returns 137, 81, 23, 1

Using pid 197 works well for me in all the options I have: vscode, Visual Studio and this extension, and it doesn't work when using one of the ids 137, 81, 23, 1.


The last error on the page Attach To Docker Container/Q & A is the same that I have. Maybe because the pid from dotnet doesn't work in all cases. I fixed this problem.

Can I create a issue for that?

One thing I can do is show all the pids in the selection (projectName + dotnet). I need to update the code. E.g: the command below will return the following pids:

docker exec -it {containerName/containerID} pidof {projectName} dotnet returns 197 137 81 23 1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants