fixed call tag completely. Should be done for now.

This commit is contained in:
barant 2025-01-09 13:57:12 -08:00
parent 4f616021f3
commit 3f4ca13f3f
3 changed files with 11 additions and 3 deletions

View File

@ -443,6 +443,12 @@ namespace jet {
}
void Tag::storeVariable(coreutils::ZString variable, coreutils::MString value, coreutils::ZString scope) {
if((scope == "global") || (scope == ""))
global.variables[variable] = value;
else if(scope == "local")
local->variables[variable] = value;
else if(scope == "parent")
local->parent->variables[variable] = value;
}
void Tag::storeVariable(coreutils::ZString variable) {

View File

@ -31,7 +31,7 @@ namespace jet {
close(fdo[0]);
dup2(fdo[1], 1);
if(keywordDefined("input")) {
coreutils::ZString input(resolveKeyword("input"));
coreutils::MString input(resolveKeyword("input"));
pipe(fdi);
if(fork() == 0) {
close(fdi[0]);
@ -48,7 +48,9 @@ namespace jet {
}
close(fdo[1]);
if(keywordDefined("name")) {
storeVariable(resolveKeyword("name"));
coreutils::MString value;
value.read(fdo[0]);
storeVariable(resolveKeyword("name"), value, resolveKeyword("scope"));
} else
out.read(fdo[0]);
waitpid(pid, &status, 0);

View File

@ -3,6 +3,6 @@
<set name="abc" value="abcdefg" />
<call pgm="cat" error="error" input="$[abc]xyz" name="test1" />
test1=$[test1]
name1=#[localname]
name1=$[%name1]
error=$[error]
</jet>