Skip to content

Commit 5da1f0c

Browse files
bzoztargos
authored andcommitted
doc, win: improve os.setPriority documentation
PR-URL: #22817 Fixes: #22799 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 6ed5845 commit 5da1f0c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

doc/api/os.md

+3
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ priority classes, `priority` is mapped to one of six priority constants in
371371
mapping may cause the return value to be slightly different on Windows. To avoid
372372
confusion, it is recommended to set `priority` to one of the priority constants.
373373

374+
On Windows setting priority to `PRIORITY_HIGHEST` requires elevated user,
375+
otherwise the set priority will be silently reduced to `PRIORITY_HIGH`.
376+
374377
## os.tmpdir()
375378
<!-- YAML
376379
added: v0.9.9

test/parallel/test-os-process-priority.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ function checkPriority(pid, expected) {
116116
return;
117117
}
118118

119+
// On Windows setting PRIORITY_HIGHEST will only work for elevated user,
120+
// for others it will be silently reduced to PRIORITY_HIGH
119121
if (expected < PRIORITY_HIGH)
120-
assert.strictEqual(priority, PRIORITY_HIGHEST);
122+
assert.ok(priority === PRIORITY_HIGHEST || priority === PRIORITY_HIGH);
121123
else if (expected < PRIORITY_ABOVE_NORMAL)
122124
assert.strictEqual(priority, PRIORITY_HIGH);
123125
else if (expected < PRIORITY_NORMAL)

0 commit comments

Comments
 (0)