summaryrefslogtreecommitdiff
path: root/vms
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2013-11-30 08:47:09 -0600
committerCraig A. Berry <craigberry@mac.com>2013-11-30 08:59:14 -0600
commite2d6c6fbf5bb83382dc53d8168358447160042a0 (patch)
tree0b438589b8e6655656d153432de23177b3c23764 /vms
parent6b7c504113d6a1351d094bcb937e5d90c03c6355 (diff)
downloadperl-e2d6c6fbf5bb83382dc53d8168358447160042a0.tar.gz
Fix stdin inheritance for system and backticks on VMS.
The documentation to LIB$SPAWN says that standard input will be inherited from the parent if not specified, and we've been depending on that. But it seems not to actually work that way as a simple $ perl -e "system('edit foo.tmp');" was failing due to the input not being a terminal. So set up the input explicitly using the same mechanism we've always used for output and error. Except when SYS$INPUT is a "directory," which probably means it's a channel open on a volume that holds a command procedure.
Diffstat (limited to 'vms')
-rw-r--r--vms/vms.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/vms/vms.c b/vms/vms.c
index a3324c748e..cb20e3b4a6 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -4336,6 +4336,12 @@ safe_popen(pTHX_ const char *cmd, const char *in_mode, int *psts)
} else if (*mode == 'n') { /* separate subprocess, no Perl i/o */
+ /* Let the child inherit standard input, unless it's a directory. */
+ Stat_t st;
+ (void)my_trnlnm("SYS$INPUT", in, 0);
+ if (!flex_stat(in, &st) && S_ISDIR(st.st_mode))
+ *in = '\0';
+
info->out = pipe_mbxtofd_setup(aTHX_ fileno(stdout), out);
if (info->out) {
info->out->pipe_done = &info->out_done;