Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows un-redirected system call fails from extension-launched redirected perl #10790

Open
p5pRT opened this issue Nov 1, 2010 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 1, 2010

Migrated from rt.perl.org#78760 (status was 'open')

Searchable as RT78760$

@p5pRT
Copy link
Author

p5pRT commented Nov 1, 2010

From johnkw@univaud.com

All that's required is a command to run that prints to stdout. In this example I use another Perl command, but it could be anything.

The complete redirect_fail.pl file to reproduce is then​:
system('perl -e "print qq(hi) or die \$!; close(STDOUT) or die \$!;"');

It only fails if it is "extension-launched" via the .pl extension. Ie, this fails​:
C​:\>redirect_fail.pl > foo.txt
Bad file descriptor at -e line 1.

But this works as expected​:
C​:\>c​:\perl\bin\perl.exe redirect_fail.pl > foo.txt

Known to fail in both cygwin and ActiveState Perls. Known to fail on Win 2000 and XP. (Does not fail however on Win 2008 R2.)

Note "un-redirected system call fails" because redirected system calls work fine. Also the backtick operator works in all tested scenarios.

@p5pRT
Copy link
Author

p5pRT commented Nov 2, 2010

From johnkw@univaud.com

Another workaround is to use IPC​::Open3​::open3().

@p5pRT
Copy link
Author

p5pRT commented Dec 2, 2010

From johnkw@univa.com

Note that $^X should report the same path in any of the cases, and does even in the failing cases. (So it's not an issue of .pl invoking a different command line.)


Notice from Univa UD Postmaster​:

This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. This message has been content scanned by the Univa UD Tumbleweed MailGate.


@p5pRT
Copy link
Author

p5pRT commented Dec 2, 2010

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Feb 18, 2017

From itcharlie@gmail.com

We no longer support Windows 2000 and Windows XP. In Windows 7 with Strawberry Perl 5.24.1, the code snippet works just fine​:

system('perl -e "print qq(hi) or die \$!; close(STDOUT) or die \$!;"');

++++++
PS C​:\Users\cgonzalez\Desktop> perl .\redirect.pl
hi
PS C​:\Users\cgonzalez\Desktop> perl .\redirect.pl >foot.txt
PS C​:\Users\cgonzalez\Desktop> cat .\foot.txt
hi
++++++

I will for an update in the next 7 days, if there is not update I will ping someone from p5p group to mark this ticket as "Won't Fix".

@p5pRT

This comment has been minimized.

@p5pRT
Copy link
Author

p5pRT commented Feb 18, 2017

From itcharlie@gmail.com

Disregard post. This issue still exists but this time around the -e error string doesn't show up and the output file is empty.

++++
PS C​:\Users\cgonzalez\Desktop> .\redirect.pl >foo.txt
PS C​:\Users\cgonzalez\Desktop> cat .\foo.txt
++++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants