gflohr has asked for the wisdom of the Perl Monks concerning the following question:
A Perl script is supposed to run on a regular system, under Windows, and inside a docker container via docker-compose. The following line gives me a headache:
my $input = <STDIN>;
It is clear that this will not work in my container because there is no standard input. I want it to fail and bail out. The problem is that it never returns.
How can I detect that situation in a clean way?
One solution would be to check whether I'm running inside a container and then bail out right away. But that is ugly and maybe not very reliable. I could also try to set an alarm but that may not work under Windows.
Any better idea?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Docker Container Started With Docker-Compose and <STDIN>
by roboticus (Chancellor) on Sep 12, 2019 at 17:06 UTC | |
|
Re: Docker Container Started With Docker-Compose and <STDIN>
by haukex (Archbishop) on Sep 12, 2019 at 17:53 UTC | |
|
Re: Docker Container Started With Docker-Compose and <STDIN>
by Marshall (Canon) on Sep 12, 2019 at 16:50 UTC | |
|
Re: Docker Container Started With Docker-Compose and <STDIN>
by bliako (Abbot) on Sep 12, 2019 at 21:16 UTC | |
|
Re: Docker Container Started With Docker-Compose and <STDIN>
by NERDVANA (Priest) on Sep 14, 2019 at 02:05 UTC | |
|
Re: Docker Container Started With Docker-Compose and <STDIN>
by kcott (Archbishop) on Sep 20, 2019 at 09:16 UTC |