Skip to content

Use exit codes to signal command success status #816

@frek818

Description

@frek818

Describe the bug
I expect the query run command to exit with a non-zero exit code when the query fails.

Currently it only prints this json that states the error:

{
  "schema_version": "20240607",
  "panels": {
    "custom.dashboard.sql_oiour2yi": {
      "dashboard": "custom.dashboard.sql_oiour2yi",
      "error": "1 child failed with an error",
      "name": "custom.dashboard.sql_oiour2yi",
      "panel_type": "dashboard",
      "source_definition": "",
      "status": "error",
      "title": "Custom query [oiour2yi]"
    },
    "custom.table.results": {
      "dashboard": "custom.dashboard.sql_oiour2yi",
      "error": "relation \"table_that_does_not_exist\" does not exist (SQLSTATE 42P01)",
      "name": "custom.table.results",
      "panel_type": "table",
      "source_definition": "",
      "status": "error",
      "sql": "select * from table_that_does_not_exist",
      "properties": {
        "name": "results"
      }
    }
  },
  "inputs": {},
  "variables": {},
  "search_path": null,
  "start_time": "2025-06-09T18:58:33.124963-04:00",
  "end_time": "2025-06-09T18:58:33.150359-04:00",
  "layout": {
    "name": "custom.dashboard.sql_oiour2yi",
    "children": [
      {
        "name": "custom.table.results",
        "panel_type": "table"
      }
    ],
    "panel_type": "dashboard"
  },
  "metadata": {}
}

Powerpipe version (powerpipe -v)
Powerpipe v1.2.6

To reproduce
Run this command.

powerpipe query run 'select * from table_that_does_not_exist'

Expected behavior
Exit with a non-zero exit code so that the shell knows that the command was not successful

Additional context
I'm using the powerpipe query run command in a cicd pipeline and I want the pipeline to fail when a command is invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingext:needs-triageExternal issues that have been accepted and now need initial review/assessment/fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions