Skip to content

feat: --background#146

Merged
raymondk merged 23 commits intomainfrom
SDK-2373-icp-cli-can-launch-a-network-in-the-background-and-terminate-it-cleanly
Oct 20, 2025
Merged

feat: --background#146
raymondk merged 23 commits intomainfrom
SDK-2373-icp-cli-can-launch-a-network-in-the-background-and-terminate-it-cleanly

Conversation

@viviveevee
Copy link
Copy Markdown
Contributor

Add icp network run --background, and icp network stop

https://dfinity.atlassian.net/browse/SDK-2373

@viviveevee viviveevee marked this pull request as ready for review October 17, 2025 11:02
@viviveevee viviveevee requested a review from a team as a code owner October 17, 2025 11:02
@raymondk
Copy link
Copy Markdown
Contributor

I tried this out but it doesn't seem to be working as expected:

❯ icp network run --background
PocketIC path: /Users/raymond/bin/pocket-ic
Port file: /Users/raymond/dev/dfinity/icp-cli/examples/icp-motoko-recipe/.icp/networks/local/pocket-ic/port
Starting PocketIC...
PocketIC started on port 60180
..... snip snip .....
Press Ctrl-C to exit.  <<<<<<<<<<<<<<<<< Maybe we don't print this in background mode


❯ ps aux | grep pocket
raymond           6382   3.6  0.9 435829296 291760 s003  S    11:04AM   0:02.12 /Users/raymond/bin/pocket-ic --port-file /Users/raymond/dev/dfinity/icp-cli/examples/icp-motoko-recipe/.icp/networks/local/pocket-ic/port --ttl 2592000 --log-levels error
..... snip snip .....

❯ icp network stop
Stopping background network (PID: 6380)...
Network stopped successfully

❯ ps aux | grep pocket
raymond           6382   1.2  0.8 435806784 264624 s003  S    11:04AM   0:02.68 /Users/raymond/bin/pocket-ic --port-file /Users/raymond/dev/dfinity/icp-cli/examples/icp-motoko-recipe/.icp/networks/local/pocket-ic/port --ttl 2592000 --log-levels error
..... snip snip .....

❯ kill -9 6382
❯ ps aux | grep pocket
raymond           6577   0.0  0.0 410060112     32 s003  S+   11:06AM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox --exclude-dir=.venv --exclude-dir=venv pocket

So it looks like the pid being recorded is not the correct one.

@viviveevee
Copy link
Copy Markdown
Contributor Author

The pid that gets recorded is not the pocketic pid, but the equivalent of icp network run, so you need to search for it with ps aux | grep icp

@raymondk raymondk merged commit 076ff98 into main Oct 20, 2025
36 checks passed
@raymondk raymondk deleted the SDK-2373-icp-cli-can-launch-a-network-in-the-background-and-terminate-it-cleanly branch October 20, 2025 14:56
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