Results 1 to 2 of 2

Thread: how to open STDIN to wait when reading

  1. #1
    Join Date
    Jan 2010
    Location
    Wheeling WV USA
    Beans
    1,476
    Distro
    Xubuntu 18.04 Bionic Beaver

    how to open STDIN to wait when reading

    normally when running a command in Linux under a shell, the command inherits fd 0 (STDIN) still open to the terminal. programs that include fd 0 in select/poll lists won't get any events from the terminal if there is nothing typed in. i want to run such a program in the background without it reading from the terminal. so i need to give it fd 0 open to something else. /dev/null won't work because it will get an immediate wake up that it can do read, and doing read will immediately give it an EOF. most of these programs will exit in such cases or have other undesired behavior.

    what i want is a way to have fd 0 open to something that won't give it an EOF or any data of any kind or cause the program to spin in a loop or wake up for fd 0. so /dev/zero is no good (useless data forever). and /dev/null is no good (EOF). any ideas?
    What do you call someone who speaks 3 languages? Trilingual.
    What do you call someone who speaks 2 languages? Bilingual.
    What do you call someone who speaks 1 language? American.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: how to open STDIN to wait when reading

    Have you considered opening a named pipe? Then you can write to that pipe from another process to provide commands to a running program.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •