Skip to content

Commit d21244b

Browse files
committed
subprocess_run: correct high level interface nargout and improve test
1 parent f4bdb71 commit d21244b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

+stdlib/+test/TestSys.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ function test_simple_run(tc)
66
tc.assumeTrue(usejava("jvm"), "Java required")
77

88
if ispc
9-
c = 'dir';
9+
c = ["cmd", "/c", "dir"];
1010
else
1111
c = 'ls';
1212
end
1313

14-
[status, msg] = stdlib.subprocess_run(c);
14+
[status, msg, err] = stdlib.subprocess_run(c);
1515
tc.verifyEqual(status, 0)
1616
tc.verifyTrue(strlength(msg) > 0)
17+
tc.verifyTrue(strlength(err) == 0)
1718

1819
end
1920

+stdlib/subprocess_run.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,12 @@
3131
[status, stdout, stderr] = stdlib.sys.subprocess_run(cmd_array, ...
3232
'env', opt.env, 'cwd', opt.cwd, "stdin", opt.stdin);
3333

34+
if nargout<3
35+
fprintf(2, stderr)
36+
end
37+
38+
if nargout<2
39+
disp(stdout)
40+
end
41+
3442
end

0 commit comments

Comments
 (0)