Add check for io.popen modes.

This commit is contained in:
Enyby
2019-10-13 06:16:21 +03:00
parent 6efb6f000e
commit edfe1a5fde

View File

@@ -386,6 +386,7 @@ public class IoLib extends TwoArgFunction {
// io.popen(prog, [mode]) -> file // io.popen(prog, [mode]) -> file
public Varargs _io_popen(String prog, String mode) throws IOException { public Varargs _io_popen(String prog, String mode) throws IOException {
if (!"r".equals(mode) && !"w".equals(mode)) argerror(2, "invalid value: '" + mode + "'; must be one of 'r' or 'w'");
return openProgram(prog, mode); return openProgram(prog, mode);
} }