Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: would be nice for a ThreadJob to be able to clean itself up #63

Open
jazzdelightsme opened this issue Sep 16, 2020 · 1 comment

Comments

@jazzdelightsme
Copy link
Contributor

I want to launch a “background” task as a ThreadJob, as part of a larger script. The script will likely finish before the job, and it’s okay if the user exits PowerShell before the job finishes. I don’t mind if the user can see it (via Get-Job) while it’s running, but it would be nice to automagically clean it up when it finishes. But I can’t find a way for it to remove itself… it seems the job is invisible to itself. It would be nice if this could be supported somehow (perhaps an -AutoRemoveJob option?).

Thanks!

@JustinGrote
Copy link

@jazzdelightsme you can set a Register-ObjectEvent on the job completed trigger to remove it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants