diff --git a/Tag.cpp b/Tag.cpp
index 0feb989..cb96be6 100644
--- a/Tag.cpp
+++ b/Tag.cpp
@@ -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) {
diff --git a/__call.cpp b/__call.cpp
index 5f6c235..a9ecdf1 100644
--- a/__call.cpp
+++ b/__call.cpp
@@ -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);
diff --git a/tests/testcall.jet b/tests/testcall.jet
index be1f8bb..1cd8fb0 100755
--- a/tests/testcall.jet
+++ b/tests/testcall.jet
@@ -3,6 +3,6 @@
test1=$[test1]
-name1=#[localname]
+name1=$[%name1]
error=$[error]