Thread: Execl()ing xterm and stdin

  1. #1
    Registered User
    Join Date
    Dec 2006

    Execl()ing xterm and stdin

    Okay, same school project as before. I know now that less will automatically read from stdin. I have an IPC pipe going into the stdin descriptor of this child process, which I can then execl less to read that data.

    However, I want to run less in a new terminal window. So, I execl xterm -hold -E less.

    The problem here is that xterm is closing the IPC pipe I have routed to stdin's descriptor. Any of you know a way to prevent it from doing that, or a workaround that doesn't involve writing the contents of the pipe to a file and calling less on it?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    xterms use pseudo terminals to communicate with the outside world, so they can get input from the window, not the stdin they inherited from the environment which started them.

    There does however seem to be some kind of API which allows you to interact with a given pseudo-terminal, but that's going to take quite a bit of reading to figure out.

    Never done it, so I've no idea what's really involved at this stage.

    Starting the xterm first, then figuring out how to run your other processes might be an easier alternative.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed