Skip to content

Commit

Permalink
Merge pull request #8 from warpdotdev/daniel/add-breakaway-ok-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ohadravid authored Jan 23, 2025
2 parents 771fa06 + 8d8dfa6 commit 0890363
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/limits.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use windows::Win32::System::{
JobObjects::{
JOBOBJECT_EXTENDED_LIMIT_INFORMATION, JOB_OBJECT_LIMIT_AFFINITY,
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, JOB_OBJECT_LIMIT_PRIORITY_CLASS,
JOB_OBJECT_LIMIT_SCHEDULING_CLASS, JOB_OBJECT_LIMIT_WORKINGSET,
JOB_OBJECT_LIMIT_BREAKAWAY_OK, JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE,
JOB_OBJECT_LIMIT_PRIORITY_CLASS, JOB_OBJECT_LIMIT_SCHEDULING_CLASS,
JOB_OBJECT_LIMIT_WORKINGSET,
},
Threading::{
ABOVE_NORMAL_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS,
Expand Down Expand Up @@ -61,6 +62,14 @@ impl ExtendedLimitInfo {
self
}

/// If any process associated with the job creates a child process using
/// this flag, the child process is not associated with the job.
pub fn limit_breakaway_ok(&mut self) -> &mut Self {
self.0.BasicLimitInformation.LimitFlags |= JOB_OBJECT_LIMIT_BREAKAWAY_OK;

self
}

/// Causes all processes associated with the job to use the same priority class.
/// Note: Processes and threads cannot modify their priority class.
/// The calling process must enable the `SE_INC_BASE_PRIORITY_NAME` privilege.
Expand Down

0 comments on commit 0890363

Please sign in to comment.