Skip to content

Commit 81c92a1

Browse files
committed
R2019b compatible
1 parent 1c24148 commit 81c92a1

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

+stdlib/subprocess_run.m

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
function [status, msg] = subprocess_run(cmd, opt)
2929
arguments
3030
cmd (1,:) string
31-
opt.env struct {mustBeScalarOrEmpty} = struct.empty
31+
opt.env (1,1) struct = struct()
3232
opt.cwd (1,1) string = ""
3333
opt.stdin (1,1) string = ""
3434
opt.stdout (1,1) logical = true
@@ -64,15 +64,11 @@
6464
end
6565

6666
% deal struct into name, value pairs for system()
67-
if isempty(opt.env)
68-
env_pairs = {};
69-
else
70-
f = fieldnames(opt.env);
71-
env_pairs = cell(1, 2 * numel(f));
72-
for i = 1:numel(f)
73-
env_pairs{2*i-1} = f{i};
74-
env_pairs{2*i} = opt.env.(f{i});
75-
end
67+
f = fieldnames(opt.env);
68+
env_pairs = cell(1, 2 * numel(f));
69+
for i = 1:numel(f)
70+
env_pairs{2*i-1} = f{i};
71+
env_pairs{2*i} = opt.env.(f{i});
7672
end
7773

7874
%% Gfortran streams

find_compiler.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
function comp = find_compiler(lang)
22
arguments (Output)
3-
comp string {mustBeScalarOrEmpty}
3+
comp string
44
end
55

66
co = mex.getCompilerConfigurations(lang);

test/TestSubprocess.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ function test_cwd(tc)
6767
c = 'ls -l';
6868
end
6969

70-
[s, m] = stdlib.subprocess_run(c, echo=true);
70+
[s, m] = stdlib.subprocess_run(c);
7171
tc.assertEqual(s, 0, "status non-zero")
7272
tc.verifyGreaterThan(strlength(m), 0, "empty directory not expected")
7373

74-
[s, mc] = stdlib.subprocess_run(c, cwd=matlabroot, echo=true);
74+
[s, mc] = stdlib.subprocess_run(c, cwd=matlabroot);
7575
tc.assertEqual(s, 0, "status non-zero")
7676
tc.verifyNotEqual(m, mc, "expected different directory to have different contents")
7777

test_main.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
function test_main(context, sel)
22
arguments
3-
context {mustBeScalarOrEmpty} = []
4-
sel {mustBeScalarOrEmpty} = ~HasTag("exe") & ~HasTag("mex") & ~HasTag("java_exe")
3+
context = []
4+
sel = ~HasTag("exe") & ~HasTag("mex") & ~HasTag("java_exe")
55
end
66

77
import matlab.unittest.TestRunner

0 commit comments

Comments
 (0)