Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.
This repository was archived by the owner on May 21, 2025. It is now read-only.

Abort program if a subprocess fails #60

@jb-adams

Description

@jb-adams

@tschaffter @jaeddy

Currently, it doesn't seem that the program exits early if a subprocess (executed through shell.exec) fails. For example, I sometimes get the following error from the npx redoc-cli bundle --output ${indexPath} ${OPENAPI_YAML_PATH} ${redocOpts} command:

TypeError: Object(...) is not a function
    at new GroupModel (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:10182:49)
    at /usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:10292:29
    at Array.map (<anonymous>)
    at mapHeadingsDeep (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:10291:26)
    at Function.MenuBuilder.addMarkdownItems (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:10303:16)
    at Function.MenuBuilder.buildStructure (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:10270:45)
    at new SpecStore (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:10161:53)
    at new AppStore (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:12804:21)
    at Module.<anonymous> (/usr/local/lib/node_modules/redoc-cli/node_modules/redoc/bundles/redoc.lib.js:12788:43)
    at step (/usr/local/lib/node_modules/redoc-cli/node_modules/tslib/tslib.js:140:27)

When running this command manually, I can see the exit code is 1.

Can we introduce a module that will run all the shell commands in sequence, and after each one, check the exit code? If 0, continue as normal, if not, throw an error. This will make it easier to see when the program has failed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions