Skip to content

Commit

Permalink
Use TaskStatus for CargoLoginTask error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Santos committed Jan 11, 2024
1 parent 70b0deb commit ca364bf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kraken-build/src/kraken/std/cargo/tasks/cargo_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from subprocess import run
from sys import stderr

from kraken.core import Property, Task
from kraken.core import Property, Task, TaskStatus

from ..config import CargoRegistry

Expand All @@ -14,7 +14,7 @@ class CargoLoginTask(Task):
#: The registries to insert into the configuration.
registries: Property[list[CargoRegistry]] = Property.default_factory(list)

def execute(self) -> None:
def execute(self) -> TaskStatus:
for registry in self.registries.get():
publish_token = registry.publish_token
if publish_token is None:
Expand All @@ -34,6 +34,5 @@ def execute(self) -> None:
pass
else:
# unknown error, fail normally
print(repr(p.stderr))
stderr.write(p.stderr.decode())
p.check_returncode()
return TaskStatus.failed("could not run cargo login")
return TaskStatus.succeeded()

0 comments on commit ca364bf

Please sign in to comment.