diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 00017205faa04e601ed363f49d53e18215d73449..6088610bd3ec48598c345aab8f4c2b6c3940648f 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,8 @@ +Version 6.1.0 (2023-02-19) +===================================================== + +* Pass on yarn's exit code + Version 6.0.3 (2022-11-01) ===================================================== diff --git a/django_yarnpkg/management/base.py b/django_yarnpkg/management/base.py index 4b4b1cc3712c0521e2ce498afd607b63f4c3b1ec..59aee0e8b78bbbc57b8e1b9a76c24a3150cf612b 100644 --- a/django_yarnpkg/management/base.py +++ b/django_yarnpkg/management/base.py @@ -24,4 +24,4 @@ class BaseYarnCommand(BaseCommand): raise YarnNotInstalled() def _install(self, args): - yarn_adapter.install(settings.YARN_INSTALLED_APPS, *args) + return yarn_adapter.install(settings.YARN_INSTALLED_APPS, *args) diff --git a/django_yarnpkg/management/commands/yarn.py b/django_yarnpkg/management/commands/yarn.py index f330e3124f8112fa13975e417ec95da48ad10337..5b018d75ab72b3550e635bfc1925f18971992d1c 100644 --- a/django_yarnpkg/management/commands/yarn.py +++ b/django_yarnpkg/management/commands/yarn.py @@ -1,3 +1,4 @@ +import sys from ...yarn import yarn_adapter from ..base import BaseYarnCommand from argparse import REMAINDER @@ -14,9 +15,10 @@ class Command(BaseYarnCommand): super(Command, self).handle(*args, **options) args = args or tuple(options.pop('command')) if self._is_single_command('install', args): - self._install([]) + ret = self._install([]) else: - yarn_adapter.call_yarn(args) + ret = yarn_adapter.call_yarn(args) + sys.exit(ret) def _is_single_command(self, name, args): return len(args) == 1 and args[0] == name diff --git a/django_yarnpkg/management/commands/yarn_install.py b/django_yarnpkg/management/commands/yarn_install.py index 807eac47c6e1b7d12d36b10807d9d92160452209..ef8ed95ead4a9a34e9fbb2d0b143e016974d7132 100644 --- a/django_yarnpkg/management/commands/yarn_install.py +++ b/django_yarnpkg/management/commands/yarn_install.py @@ -1,3 +1,4 @@ +import sys from optparse import make_option from ..base import BaseYarnCommand @@ -7,4 +8,5 @@ class Command(BaseYarnCommand): def handle(self, *args, **options): super(Command, self).handle(*args, **options) - self._install(args) + ret = self._install(args) + sys.exit(ret) diff --git a/django_yarnpkg/yarn.py b/django_yarnpkg/yarn.py index fa255471e27cdf1ae81a428dd37db76a2d1d500b..c252dc03a23cf5c3fd85a78f426c191d244e6d68 100644 --- a/django_yarnpkg/yarn.py +++ b/django_yarnpkg/yarn.py @@ -31,11 +31,11 @@ class YarnAdapter(object): proc = subprocess.Popen( [self._yarn_path] + list(args), cwd=self._node_modules_root) - proc.wait() + return proc.wait() def install(self, packages, *options): """Install packages from yarn""" - self.call_yarn(['add'] + list(options) + list(packages)) + return self.call_yarn(['add'] + list(options) + list(packages)) def _accumulate_dependencies(self, data): """Accumulate dependencies"""