diff --git a/src/org/python/modules/posix/PosixModule.java b/src/org/python/modules/posix/PosixModule.java --- a/src/org/python/modules/posix/PosixModule.java +++ b/src/org/python/modules/posix/PosixModule.java @@ -520,6 +520,35 @@ } } + public static PyString __doc__mkfifo = new PyString( + "mkfifo(filename [, mode=0666])\n\n" + + "Create a FIFO (a POSIX named pipe)."); + public static void mkfifo(PyObject path) { + String cmd = "mkfifo "+absolutePath(path); + try { + Process process = Runtime.getRuntime().exec(cmd); + if (0 != process.waitFor()) { + throw errorFromErrno(path); + } + } catch (Exception e) { + System.out.println(cmd); + throw errorFromErrno(path); + } + } + + public static void mkfifo(PyObject path, int mode) { + String cmd = "mkfifo -m "+Integer.toOctalString(mode)+" "+absolutePath(path); + try { + Process process = Runtime.getRuntime().exec(cmd); + if (0 != process.waitFor()) { + throw errorFromErrno(path); + } + } catch (Exception e) { + System.out.println(cmd); + throw errorFromErrno(path); + } + } + public static PyString __doc__open = new PyString( "open(filename, flag [, mode=0777]) -> fd\n\n" + "Open a file (for low level IO).\n\n" +