Skip to content

shards run cannot handle all exit statuses #685

@HertzDevil

Description

@HertzDevil

If I put debugger in a build target, and then use shards run, the process would exit with either SIGTRAP or STATUS_BREAKPOINT. This is not a normal exit status, so Shards forwards the exit status of the process:

unless status.success?
exit status.exit_code
end

and then breaks because Process::Status#exit_code raises:

Unhandled exception: Abnormal exit has no exit code (RuntimeError)
  from /crystal/src/process/status.cr:284:19 in 'exit_code'
  from /shards/src/commands/run.cr:33:13 in '->'
  from /crystal/src/option_parser.cr:488:22 in '__crystal_main'
  from /crystal/src/crystal/main.cr:129:5 in 'main'
  from /crystal/src/crystal/system/unix/main.cr:10:3 in 'main'
  from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'

Many other abnormal exits could trigger this stack trace as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions