Skip to content

fix: finch run panic without arguments#1634

Merged
coderbirju merged 2 commits intorunfinch:mainfrom
coderbirju:fix-run-panic
Dec 18, 2025
Merged

fix: finch run panic without arguments#1634
coderbirju merged 2 commits intorunfinch:mainfrom
coderbirju:fix-run-panic

Conversation

@coderbirju
Copy link
Contributor

@coderbirju coderbirju commented Dec 5, 2025

Issue #, if available:
fixes #1633

Description of changes:
Added a length check to prevent panic when run without arguments

Testing done:
Before

~ finch run    
panic: runtime error: index out of range [0] with length 0
..
~ finch compose
panic: runtime error: index out of range [0] with length 0
..
~ finch exec
panic: runtime error: index out of range [0] with length 0
..

After

~ finch run 
Run a command in a new container. Optionally specify "ipfs://" or "ipns://" scheme to pull image from IPFS.

Usage: finch container run [flags] IMAGE [COMMAND] [ARG...]

Flags:
      --add-host strings                               Add a custom host-to-IP mapping (host:ip)
      --annotation stringArray                         Add an annotation to the container (passed through to the OCI runtime)
  -a, --attach strings                                 Attach STDIN, STDOUT, or STDERR
      --blkio-weight uint16                            Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
      --blkio-weight-device stringArray                Block IO weight (relative device weight) (default [])
      --cap-add strings                                Add Linux capabilities
      --cap-drop strings                               Drop Linux capabilities
      --cgroup-conf strings                            Configure cgroup v2 (key=value)
      --cgroup-parent string                           Optional parent cgroup for the container
      --cgroupns string                                Cgroup namespace to use, the default depends on the cgroup version ("host"|"private") (default "private")
      --cidfile string                                 Write the container ID to the file
     .....
~ finch exec
Run a command in a running container

Usage: finch exec [flags] CONTAINER COMMAND [ARG...]

Flags:
  -d, --detach             Detached mode: run command in the background
  -e, --env stringArray    Set environment variables
      --env-file strings   Set environment variables from file
  -h, --help               help for exec
  -i, --interactive        Keep STDIN open even if not attached
      --privileged         Give extended privileges to the command
  -t, --tty                Allocate a pseudo-TTY
  -u, --user string        Username or UID (format: <name|uid>[:<group|gid>])
  -w, --workdir string     Working directory inside the container

See also 'finch --help' for the global flags such as '--namespace', '--snapshotter', and '--cgroup-manager'. 

~ finch compose 
Compose

Usage: finch compose [flags] COMMAND

Commands:
  build    Build or rebuild services
  config   Validate and view the Compose file
  cp       Copy files/folders between a service container and the local filesystem
  create   Creates containers for one or more services
  down     Remove containers and associated resources
  exec     Execute a command in a running container of the service
  images   List images used by created containers in services
  kill     Force stop service containers
  logs     Show logs of running containers
  pause    Pause all processes within containers of service(s). They can be unpaused with finch compose unpause
  port     Print the public port for a port binding
  ps       List containers of services
  pull     Pull service images
  push     Push service images
  restart  Restart containers of given (or all) services
  rm       Remove stopped service containers
  run      Run a one-off command on a service
  start    Start existing containers for service(s)
  stop     Stop running containers without removing them.
  top      Display the running processes of service containers
  unpause  Unpause all processes within containers of service(s).
  up       Create and start containers
  version  Show the Compose version information
....
  • I've reviewed the guidance in CONTRIBUTING.md

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

pendo324
pendo324 previously approved these changes Dec 8, 2025
sondavidb
sondavidb previously approved these changes Dec 8, 2025
@Shubhranshu153
Copy link
Member

Can we add a test, if its breaking that means we are missing a test for it somewhere.

@coderbirju coderbirju dismissed stale reviews from sondavidb and pendo324 via 38c65d9 December 12, 2025 18:29
@coderbirju coderbirju force-pushed the fix-run-panic branch 3 times, most recently from 2312441 to 10a3458 Compare December 12, 2025 23:04
Shubhranshu153
Shubhranshu153 previously approved these changes Dec 13, 2025
Signed-off-by: Arjun Raja Yogidas <arjunry@amazon.com>
Signed-off-by: Arjun Raja Yogidas <arjunry@amazon.com>
@coderbirju coderbirju merged commit 6297e65 into runfinch:main Dec 18, 2025
361 of 370 checks passed
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.

finch run with no arguments results in a panic

5 participants