Basically what the title says. Sometimes, some stuff returns exit codes greater than 127. I'd like to not shell wrap if possible. Outside of wrapping in a shell and grepping in the wrap, how could I execute a command that can fail with err code >127?
Min repro example: I tried to use an aws-cli container to see if a specific image tag existed. If ReturnType.ANY truly was ANY, I'd expect this to work as written but it doesn't. AWS CLI returns err code 254 for this function if no such image exists:
@function
async def test_ecr_check_pattern(
self,
aws_config_dir: Annotated[dagger.Directory, Doc("AWS config dir (~/.aws)")],
) -> str:
"""Reproduce the exact ECR check pattern to see if it fails.
This mimics check_ecr_image_exists() but for a non-existent image.
"""
container = dag.container().from_("amazon/aws-cli:latest")
container = container.with_mounted_directory("/root/.aws", aws_config_dir)
container = container.with_env_variable("AWS_REGION", "us-east-1")
# Check for a non-existent image - this SHOULD fail but not throw
result = await container.with_exec(
[
"aws",
"ecr",
"describe-images",
"--repository-name",
"some_repo_of_mine",
"--image-ids",
"imageTag=this-tag-does-not-exist-12345",
"--region",
"us-east-1", # I <3 downtime
],
expect=dagger.ReturnType.ANY,
).sync()
exit_code = await result.exit_code()
return f"ECR check exited with code: {exit_code} (0=exists, non-zero=not found)"
Using dagger 0.19.8