From 96302e1d2791e414d3e2da7e19bcc041440cf09f Mon Sep 17 00:00:00 2001 From: brad Arant Date: Fri, 7 Nov 2025 19:35:07 -0800 Subject: [PATCH] Added ability for call tag to use container as input stream. --- __call.cpp | 17 ++++++++++++++--- tests/testcall.jet | 11 +++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/__call.cpp b/__call.cpp index b505843..7e4eff7 100644 --- a/__call.cpp +++ b/__call.cpp @@ -1,3 +1,4 @@ + #include "__call.h" #include "Exception.h" #include "MString.h" @@ -11,8 +12,8 @@ namespace jet { __call::__call(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, local) { - if(hasContainer) - throw coreutils::Exception("call tag cannot have a container."); + if(hasContainer && keywordDefined("input")) + throw coreutils::Exception("call tag cannot have both input keyword and have a container."); if(!keywordDefined("pgm")) throw coreutils::Exception("pgm keyword must be specified."); for(ix = 0; ix <= 50; ++ix) @@ -31,7 +32,17 @@ namespace jet { if(pid == 0) { close(fdo[0]); dup2(fdo[1], 1); - if(keywordDefined("input")) { + if(hasContainer) { + pipe(fdi); + if(fork() == 0) { + close(fdi[0]); + write(fdi[1], container.getData(), container.getLength()); + close(fdi[1]); + exit(0); + } + close(fdi[1]); + dup2(fdi[0], 0); + } else if(keywordDefined("input")) { coreutils::MString input(resolveKeyword("input")); pipe(fdi); if(fork() == 0) { diff --git a/tests/testcall.jet b/tests/testcall.jet index 3ef97fc..087ce56 100755 --- a/tests/testcall.jet +++ b/tests/testcall.jet @@ -1,11 +1,18 @@ #!../jet-2.0 - + test1=$[test1] name1=$[%name1] error=$[error] - + $[rc] + +From: barant@barant.com +To: brad.arant@gmail.com +Subject: This is a test email. +This is a test email being sent from a jet script with a single +call command. +