Skip to content

Commit

Permalink
doc, win: improve os.setPriority documentation
Browse files Browse the repository at this point in the history
PR-URL: #22817
Fixes: #22799
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
bzoz authored and targos committed Sep 19, 2018
1 parent d46ce65 commit d4278a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions doc/api/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ priority classes, `priority` is mapped to one of six priority constants in
mapping may cause the return value to be slightly different on Windows. To avoid
confusion, it is recommended to set `priority` to one of the priority constants.

On Windows setting priority to `PRIORITY_HIGHEST` requires elevated user,
otherwise the set priority will be silently reduced to `PRIORITY_HIGH`.

## os.tmpdir()
<!-- YAML
added: v0.9.9
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-os-process-priority.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ function checkPriority(pid, expected) {
return;
}

// On Windows setting PRIORITY_HIGHEST will only work for elevated user,
// for others it will be silently reduced to PRIORITY_HIGH
if (expected < PRIORITY_HIGH)
assert.strictEqual(priority, PRIORITY_HIGHEST);
assert.ok(priority === PRIORITY_HIGHEST || priority === PRIORITY_HIGH);
else if (expected < PRIORITY_ABOVE_NORMAL)
assert.strictEqual(priority, PRIORITY_HIGH);
else if (expected < PRIORITY_NORMAL)
Expand Down

0 comments on commit d4278a0

Please sign in to comment.