question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return an exit code for RunTargetsWithoutExiting

See original GitHub issue

Use case(s)

I want to be able to run some (cleanup) code after running the targets regardless of success/failure and still exit with the appropriate exit code

Description

Example:

var exitCode = RunTargetsWithoutExiting(args);
StopContainers();
return exitCode; // or Environment.Exit(exitCode);

Alternatives

I have none.

Additional context

NA

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
adamralphcommented, Jun 5, 2020

BTW I can see why this might start to feel a bit messy, so now I find myself considering this again:

I guess another possibility is to extend RunTargetsAndExit to also cover the more complex case of a finally block with a new optional parameter:

RunTargetsAndExit(args, finally: () => StopContainer());
1reaction
damianhcommented, May 26, 2020

Reasonable, and thanks for the discussion 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

bash - Return an exit code without closing shell
The true command is never executed but is used to build a compound command that is not exited by the -e shell flag....
Read more >
nx exiting with code 0 in CI without executing target #2219
When I run this locally, it executes as I would expect. When I execute this via AWS CodeBuild the child process executing the...
Read more >
Process Exit Codes in Python
You can set an exit code for a process via sys.exit() and retrieve the exit code via the exitcode attribute on the multiprocessing....
Read more >
Set app exit code
My client runs some checks on the target application, and if these fail,. I want to have drrun exit with a non-zero code....
Read more >
Thread: pg_rewind exiting with error code 1 when source and ...
Hi all, I have been pinged internally by a user by the fact that pg_rewind returns 1 as exit code if the target...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found