i'm trying create named pipe in java exec calls. have line of code
process p = runtime.getruntime().exec("/bin/sh -c \"mkfifo ~/myfifo && tail -f ~/myfifo | csh -s\""); but when ~/myfifo after call, not there. there reason not work?
i tried without /bin/sh -c bit, didn't work either.
thanks, erip
edit
final string [] cmds = {"/bin/sh", "-c", "\"mkfifo ~/myfifo && tail -f ~/myfifo | csh -s\""}; process p = runtime.getruntime().exec(cmds);
if write out third argument, you'll this:
"mkfifo ~/myfifo && tail -f ~/myfifo | csh -s" and if try run in shell, you'll see doesn't work:
$ "mkfifo ~/myfifo && tail -f ~/myfifo | csh -s" bash: mkfifo ~/myfifo && tail -f ~/myfifo | csh -s: no such file or directory just remove literal quotes added:
final string [] cmds = {"/bin/sh", "-c", "mkfifo ~/myfifo && tail -f ~/myfifo | csh -s"}; and remember read process.getinputstream().
Comments
Post a Comment