Score:1

cannot identify xdg-open behaviour for console application

al flag

I have created file association for a console application which accepts inputs from stdin and gives output at the stdout. It works normally when I run the application from the terminal using ./myExe. But when I launch the exe using xdg-open 'myFile', it gives out the stdout on the terminal but it does not accept any input from the stdin (It takes input from the /dev/null).

I m not able to identify whether this is the standard behaviour or have I missed something. And If this is the standard behaviour why is stdout available then? I m using Ubuntu 20.04.

Note : Both stdin and stdout are available when I use xdg-open through a ssh session.
Score:0
cn flag

This is standard behavior.

  • In an interactive terminal, standard input and output are attached to the terminal: standard input is by default the keyboard, standard output and standard error is the terminal output on screen.

  • A program running in a terminal session in the background will display output to the screen, but will not accept input from the keyboard. The program you launch with the xdg-open command runs as a separate thread in the system, independent from the terminal session, just as if you would have launched the application from clicking a file in the file manager. Once the application is launched, xdg-open terminates and your terminal is released for further input from your side. If you issue the command bg, you will indeed see there are no background processes in your terminal.

  • A program/process started from a graphical desktop environment (i.e. after clicking an icon in a menu, after launching a file, after entering a command in the Run dialog) is not connected to a terminal, so neither input or output can be seen.

Standard input/output can be redirected to a file or another device.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.