While playing with dtach in a Docker container, I found that dtach -N <some socket> <some command> seems to exit silently when it's invoked in an environment which has no terminal (which is Docker's default) but works fine if I make Docker allocate a terminal. That would make sense for the -c mode, but I'd imagine that -N could theoretically work just fine when dtach is started in a "terminal-less" environment since it creates its own PTY for the command and never attaches to it. Is this just a side effect of how dtach currently handles terminals, or is there a fundamental limitation in the Linux APIs that would prevent dtach from functioning correctly in a terminal-less environment without daemonizing?
It's an easy enough fix in my own project to just allocate a terminal, but I figured I'd mention it in case you thought it was worth looking at eventually.
While playing with
dtachin a Docker container, I found thatdtach -N <some socket> <some command>seems to exit silently when it's invoked in an environment which has no terminal (which is Docker's default) but works fine if I make Docker allocate a terminal. That would make sense for the-cmode, but I'd imagine that-Ncould theoretically work just fine whendtachis started in a "terminal-less" environment since it creates its own PTY for the command and never attaches to it. Is this just a side effect of howdtachcurrently handles terminals, or is there a fundamental limitation in the Linux APIs that would preventdtachfrom functioning correctly in a terminal-less environment without daemonizing?It's an easy enough fix in my own project to just allocate a terminal, but I figured I'd mention it in case you thought it was worth looking at eventually.