Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ GOOGLE_API_KEY variable in one of two ways.
You can execute the following command to run all of the steps in one terminal:

```sh
samples/python/scenarios/a2a/human-present/cards/run.sh --payment-method x402
samples/python/scenarios/a2a/human-present/x402/run.sh
```

Or you can run each server in its own terminal (ensure `PAYMENT_METHOD=x402` is set for all processes):
Expand Down
8 changes: 8 additions & 0 deletions samples/python/scenarios/a2a/human-present/x402/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# A script to automate the execution of the x402 payment example.
# This is a convenience wrapper that runs the standard scenario with
# the x402 payment method.

SCRIPT_DIR="$(dirname "$0")"
exec bash "$SCRIPT_DIR/../cards/run.sh" --payment-method x402 "$@"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The cards/run.sh script that is being called expects to be run from the repository root. The current implementation of this wrapper script will fail if it's not executed from the repository root itself (e.g., if a user changes into this directory and runs ./run.sh). This can be fixed by changing the current directory to the repository root before executing the cards/run.sh script.

Additionally, it's good practice to add set -e to the script to ensure it exits immediately if any command fails.

Suggested change
#!/bin/bash
# A script to automate the execution of the x402 payment example.
# This is a convenience wrapper that runs the standard scenario with
# the x402 payment method.
SCRIPT_DIR="$(dirname "$0")"
exec bash "$SCRIPT_DIR/../cards/run.sh" --payment-method x402 "$@"
#!/bin/bash
set -e
# A script to automate the execution of the x402 payment example.
# This is a convenience wrapper that runs the standard scenario with
# the x402 payment method.
# The wrapped script, cards/run.sh, expects to be run from the repository root.
# To make this script runnable from any directory, we first change to the repo root.
cd "$(dirname "$0")/../../../../../../"
exec bash "samples/python/scenarios/a2a/human-present/cards/run.sh" --payment-method x402 "$@"

Loading