Problem using select() to wait on pipes #275
Replies: 3 comments 5 replies
-
Are you calling the code from Cmd, Powershell or Cygwin? The code in Substituting |
Beta Was this translation helpful? Give feedback.
-
I get the same output as reported by @Atlant-Schmidt when I run the given program in the cmd.exe shell with Strawberry-Perl-5.42.0. I notice that the perlport documentation has this to say wrt
I don't know whether that's related to the problem, or whether the actual issue is simply the one that @shawnlaffan pointed out. The only way I know of running multiple commands on one cmd.exe command line is to separate them with Maybe there's better mileage to be obtained using PowerShell. (I don't know about that, either.) As an afterthought, I changed
When run in cygwin, the altered script still runs fine .... and in Windows it still dies in exactly the same way. (So maybe it is simply the portability issue with @Atlant-Schmidt, do you really need to run the program outside of Cygwin ? |
Beta Was this translation helpful? Give feedback.
-
I wonder if switching to IO::Select (as a replacement to the From the documentation:
@Atlant-Schmidt, it might be worth your while to investigate that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
(It's my first time here; please be gentle!)
I've got a program that I wrote for the version of Perl distributed with Cygwin. It's creating a child process and managing that child using the select() call (so that the parent can keep processing while the child process is busy).
It works a treat in the Cygwin Perl environment but when I run it in the Strawberry Perl environment, select() returns -1 and the error is "An operation was attempted on something that is not a socket.".
Interestingly enough, the child process WAS created and it goes on its way correctly; I just can't collect any output from it because of the failure of the select() call. And because of the way the rest of my code works, I fail to reap the child process when it completes.
Here (in simplified form) is my code:
Here's the output I receive:
Beta Was this translation helpful? Give feedback.
All reactions