#[SOLVED] Searching for files having git conflicts markers

1 messages · Page 1 of 1 (latest)

nimble lintel
#

Hi all

I'm looking on how I can make my Dagger function fails if I find some files having the git conflict marker.

The code below is working fine but I should negate the exit code. The find command will return

  • a non-zero exit code when nothing is retrieved (and this is what I want) --> if exit code 1 ==> success
  • a zero-exit code when at least one file is retrieved --> if exit code 0 ==> my function has to fail
command: str = r"find . -type f -exec grep -l <<<<<<< {} +"
return str(await self.container.with_exec(command.split()).stdout())

What's the best approach to do this?

Thanks!

frosty vault
#

essentially you'll want to use dagger.ReturnType.FAILURE

#

that means that you get exit code 1 = success

#

if you want to make sure that it's definitely exit code 1 (and not some other exit code), then you can get the containers exit code with exit_code and compare that

nimble lintel
#

Thanks a lot @frosty vault

#

[SOLVED] Searching for files having git conflicts markers