Moved keywords from local variables to keywords map.

This commit is contained in:
brad Arant committed 2025-01-02 16:43:53 -08:00
1 parent 907f449ecc
commit 9622b5cf8c
23 files changed
+221 -220

No files matched your search

+6 -6
View File
@@ -11,16 +11,16 @@ namespace jet {
__system::__system(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, Tag *local) : Tag(in, parentOut, global, parent, local) {
if(hasContainer)
throw coreutils::Exception("system tag cannot have a container.");
if(!variableDefined(coreutils::ZString("cmd")))
if(!keywordDefined(coreutils::ZString("cmd")))
throw coreutils::Exception("cmd keyword must be specified.");
pipe(fdo);
pid = fork();
if(pid == 0) {
close(fdo[0]);
dup2(fdo[1], 1);
if(variableDefined("input")) {
if(keywordDefined("input")) {
resolveKeyword("input");
coreutils::ZString input(variables["input"]);
coreutils::ZString input(keywords["input"]);
pipe(fdi);
if(fork() == 0) {
close(fdi[0]);
@@ -31,13 +31,13 @@ namespace jet {
close(fdi[1]);
dup2(fdi[0], 0);
}
system(variables["cmd"].c_str());
system(keywords["cmd"].c_str());
close(fdo[1]);
exit(errno);
}
close(fdo[1]);
if(variableDefined("name"))
global.variables[variables["name"]].read(fdo[0]);
if(keywordDefined("name"))
global.variables[keywords["name"]].read(fdo[0]);
else
out.read(fdo[0]);
waitpid(pid, &status, 0);