Skip to content

Commit ae5e05d

Browse files
committed
correct sys.get_process_priority
1 parent 3c5849c commit ae5e05d

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

+stdlib/+sys/get_process_priority.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
if ispc()
66
cmd = sprintf('pwsh -c "(Get-Process -Id %d).PriorityClass"', pid);
7-
else
8-
cmd = sprintf('ps -o ni= -p %d', pid);
7+
else % Linux, macOS
8+
cmd = sprintf('ps -o pri= -p %d', pid);
99
end
1010

1111
[s, m] = system(cmd);

+stdlib/get_pid.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
function pid = get_pid()
44

5-
if stdlib.matlabOlderThan('R2025a')
5+
if stdlib.isoctave()
6+
pid = getpid();
7+
elseif stdlib.matlabOlderThan('R2025a')
68
pid = feature('getpid');
79
else
810
pid = matlabProcessID;

+stdlib/get_process_priority.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111

1212
function [i, b] = get_process_priority(backend)
13-
arguments
14-
backend (1,:) string = ["dotnet", "python", "sys"]
13+
if nargin < 1
14+
backend = ["dotnet", "python", "sys"];
15+
else
16+
backend = string(backend);
1517
end
1618

1719
i = [];

AGENTS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
## Project Overview
44

55
This is a standard library project for Matlab, designed to provide a collection of commonly used functions and utilities to enhance productivity and streamline development in Matlab.
6-
We generally are not compatible with GNU Octave as the syntax we use is too new to be supported yet by GNU Octave.
76
The namespace of the project is "stdlib" as indicated by all the project functions being under directory "+stdlib/"
87

98
A primary purpose of this project is to use the external language interfaces provided by Matlab to call functions written in other scripting languages IF the language interface is enabled on the specific computer where Matlab is running.
@@ -25,6 +24,10 @@ Key limitations to minimum Matlab version include:
2524
* R2018a: mfilename('fullpath') tells the full path to the matlab .m file currently running (empty for older Matlab)
2625
* R2019b: function argument validation block "arguments"
2726

27+
## GNU Octave compatibility
28+
29+
Numerous functions are also compatible with GNU Octave, but Octave is not a primary target of this project.
30+
In particular, using GNU Octave with functions having a backend as shown in [API.md](./API.md), directly use the "stdlib.sys" namespace as Octave doesn't have built-in strings yet to support auto-backend selection.
2831

2932
## Dev Rules
3033

0 commit comments

Comments
 (0)