Skip to content

exec not returning exit code properly #1013

@sethen

Description

@sethen

Node version (or tell us if you're using electron or some other framework):

v12.20.1

ShellJS version (the most recent version/Github branch you see the bug on):

0.8.4

Operating system:

Ubuntu 20.04 LTS

Description of the bug:

shell.exec doesn't raise exit code if it is not zero.

Example ShellJS command to reproduce the error:

Here is the code I have:

#! /usr/bin/env node

const shell = require("shelljs");

shell.exec("jest --config jest.config.json --coverage");

Here is what I had to do to make this work properly:

#! /usr/bin/env node

const shell = require("shelljs");

shell.exec("jest --config jest.config.json --coverage", function (code) {
	if (code !== 0) {
		shell.exit(1);
	}
});

Shouldn't this be the default behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions