Fix issue where steampipe returned 0 exit code even if failed to export snapshot. Closes #4276

This commit is contained in:
Puskar Basu
2024-05-21 18:45:40 +05:30
committed by GitHub
parent 7cef272d44
commit 663f4031ea
2 changed files with 8 additions and 2 deletions

View File

@@ -317,7 +317,10 @@ func runSingleDashboard(ctx context.Context, targetName string, inputs map[strin
// export the result (if needed)
exportArgs := viper.GetStringSlice(constants.ArgExport)
exportMsg, err := initData.ExportManager.DoExport(ctx, snap.FileNameRoot, snap, exportArgs)
error_helpers.FailOnErrorWithMessage(err, "failed to export snapshot")
if err != nil {
exitCode = constants.ExitCodeSnapshotCreationFailed
error_helpers.FailOnErrorWithMessage(err, "failed to export snapshot")
}
// print the location where the file is exported
if len(exportMsg) > 0 && viper.GetBool(constants.ArgProgress) {

View File

@@ -281,7 +281,10 @@ func executeSnapshotQuery(initData *query.InitData, ctx context.Context) int {
// export the result if necessary
exportArgs := viper.GetStringSlice(constants.ArgExport)
exportMsg, err := initData.ExportManager.DoExport(ctx, snap.FileNameRoot, snap, exportArgs)
error_helpers.FailOnErrorWithMessage(err, "failed to export snapshot")
if err != nil {
exitCode = constants.ExitCodeSnapshotCreationFailed
error_helpers.FailOnErrorWithMessage(err, "failed to export snapshot")
}
// print the location where the file is exported
if len(exportMsg) > 0 && viper.GetBool(constants.ArgProgress) {
fmt.Printf("\n")