开发者

Redirecting stdin through a FIFO

I'm running a server app (written in Java) under GNU/Linux which takes input (from stdin, I guess) and interprets it to run some commands. I dont want to r开发者_如何学Pythonun the app inside a terminal window (I'd like to run a daemon), but I'd still like to be able to input commands whenever I want to. I thought I might be able to do that using fifos, so I created it using mknod. The problem is cat fifofile > java... and cat fifofile | java ... fail with a "file not found" error for some reason.

Using only cat to read and write and the fifo works flawlessly.

Is there any way to fix this, or any other way to achieve the same goal?


So, Minecraft? The best way to do this is to have a bona-fide tty for the console part of the application. screen is an easy way to do that.


Have you tried java < fifofile? What about something like exec 3<&0; exec 0<fifofile; java?

What shell are you using? You might be able to use process substitution or coprocesses if you're using a shell that supports them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜