Skip to content

Comments

feat(cli): changes to run to work better with detached stdin (no shell)#426

Open
tuler wants to merge 1 commit intofeature/anvil-forkfrom
feature/run-stdin-detached
Open

feat(cli): changes to run to work better with detached stdin (no shell)#426
tuler wants to merge 1 commit intofeature/anvil-forkfrom
feature/run-stdin-detached

Conversation

@tuler
Copy link
Member

@tuler tuler commented Feb 20, 2026

This makes cartesi run to work better with detached stdin, by not running the shell at the end.
You can test this by running cartesi run < /dev/null.
The goal is to make run work well when it's launched from another spawn.
The application deployment had to be moved from the shell loop to before the shell is called, so it happens with this new mode.

@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

🦋 Changeset detected

Latest commit: c9b9951

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cartesi/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 92.96% (🎯 0%) 726 / 781
🔵 Statements 92.96% 726 / 781
🔵 Functions 92.54% 62 / 67
🔵 Branches 0% 0 / 0
📁 File Coverage (11 files)
File Lines Statements Functions Branches Uncovered Lines
apps/cli/src/builder/directory.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/docker.ts 🟢 88.68% 🟢 88.68% 🟡 75% 🔴 0% 83-85, 139-147
apps/cli/src/builder/empty.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/none.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/builder/tar.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/config.ts 🟢 92.63% 🟢 92.63% 🟢 94.12% 🔴 0% 65-66, 217, 226, 235, 255, ...
apps/cli/src/exec/cartesi-machine.ts 🟡 75% 🟡 75% 🟡 66.67% 🔴 0% 10-12, 28-30
apps/cli/src/exec/genext2fs.ts 🟢 96.92% 🟢 96.92% 🟢 100% 🔴 0% 87-88
apps/cli/src/exec/index.ts 🟢 100% 🟢 100% 🟢 100% 🔴 0% -
apps/cli/src/exec/mksquashfs.ts 🟢 91.23% 🟢 91.23% 🟢 100% 🔴 0% 68-72
apps/cli/src/exec/util.ts 🟢 94.44% 🟢 94.44% 🟢 100% 🔴 0% 47-48

Copy link
Contributor

@endersonmaia endersonmaia left a comment

Choose a reason for hiding this comment

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

for me Anvil never gets healthy

docker inspect --format "{{json .State.Health.Log }}" my-go-dapp-anvil-1 | jq .
...
    "ExitCode": 2,
    "Output": "/usr/local/bin/eth_isready: 7: 1: parameter not set\n"
...

It was introduced when defining set -u in the eth_isready in cartesi/sdk.

An easy fix should be something like

BLOCK_NUMBER=${1:-}

if [ -n "$BLOCK_NUMBER" ]; then
...

@tuler
Copy link
Member Author

tuler commented Feb 20, 2026

for me Anvil never gets healthy

docker inspect --format "{{json .State.Health.Log }}" my-go-dapp-anvil-1 | jq .
...
    "ExitCode": 2,
    "Output": "/usr/local/bin/eth_isready: 7: 1: parameter not set\n"
...

It was introduced when defining set -u in the eth_isready in cartesi/sdk.

An easy fix should be something like

BLOCK_NUMBER=${1:-}

if [ -n "$BLOCK_NUMBER" ]; then
...

Hmm, that's for another PR right? How did it work before?

@tuler
Copy link
Member Author

tuler commented Feb 20, 2026

Maybe we should rethink how to do this better, because today docker compose is always executed in the background with --detach. But maybe in the scenario where TTY is not there, and shell is not there, it should run on foreground.

@endersonmaia
Copy link
Contributor

Hmm, that's for another PR right?

I'll send that PR.

How did it work before?

We're focusing on testing the --fork-url, and for that, it works since we have a block number.

It fails without --fork-url.

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.

2 participants