Skip to content

State and direction of this project #10

@rasmushalland

Description

@rasmushalland

Hi,

I recently found this project, and found its coverage of windows jobs very appealing. I've attempted to replace my old, minimal job object wrapper with this package, but ran into several problems.

I use job objects for browser testing. More specifically, in automated browser tests, I launch the browser in jobs configured to kill their processes when the job ends, so that there are no browser processes hanging around after the process running the tests, terminates. There is also the twist that sometimes I would like for the browser to not be killed along when the testing process terminates, so that I can interact with the browser. To do that, I give the jobs names, and attach to them from a separate application, which keeps the
jobs alive.

The issues that I ran into when I tried to replace my own wrapper with this one, are roughly the following:

First, opening a job by name fails. I made it work by changing two lines.

Then, I wanted to set the job setting/flag JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE that causes windows to kill processes in the job when the job ends. That caused the Selenium browser testing library to fail a moment later, claiming that the started process did not exist. Commenting out most of the job configuration code in JobObject.SetLimits made the problem go away. The job setup that I did at this point was nothing more than the following:

_windowsJobObject = JobObject.Open("MyJobName");
_windowsJobObject.SetLimits(new JobLimits() {  });

I would think that a job set up in that way should not put up much restriction for the processes that are assigned to it, but as mentioned it turned out otherwise.

The first problem (opening the named job) has a tiny fix, and I could easily make a PR for that. But the second problem probably requires more changes. I was considering making those changes, but the apparent complete lack of tests made me reconsider.

So my question is whether this project would be open to adressing these issues and getting some unit tests? If so, I might open some PRs.

OS: Windows 11
.NET version: 4.8
VS Version: VS 2022

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions