Some work on call tag.
This commit is contained in:
1 parent
f1624b074a
commit
2dd41238de
4 files changed
+9
-6
No files matched your search
+5
-3
@@ -1,6 +1,7 @@
|
||||
#include "__call.h"
|
||||
#include "Exception.h"
|
||||
#include "MString.h"
|
||||
#include <ostream>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
@@ -10,8 +11,8 @@ namespace jet {
|
||||
|
||||
__call::__call(coreutils::ZString &in, coreutils::MString &out, Global &global) : Tag(in, out, global) {
|
||||
if(hasContainer)
|
||||
throw coreutils::Exception("call cannot have a container.");
|
||||
if(!variableDefined(coreutils::ZString("pgm")))
|
||||
throw coreutils::Exception("call tag cannot have a container.");
|
||||
if(!variableDefined("pgm"))
|
||||
throw coreutils::Exception("pgm keyword must be specified.");
|
||||
argv[0] = variables["pgm"].c_str(); // TODO: Need to peel off the program name only and pass as argv[0].
|
||||
for(ix = 1; ix <= 50; ++ix) {
|
||||
@@ -42,7 +43,6 @@ namespace jet {
|
||||
}
|
||||
rc = execve(variables["pgm"].c_str(), argv, NULL);
|
||||
close(fdo[1]);
|
||||
std::cout << "rc: " << rc << std::endl;
|
||||
exit(rc);
|
||||
}
|
||||
close(fdo[1]);
|
||||
@@ -51,6 +51,8 @@ namespace jet {
|
||||
else
|
||||
out.read(fdo[0]);
|
||||
waitpid(pid, &status, 0);
|
||||
if(variableDefined("status"))
|
||||
global.variables[variables["status"]] = (status >> 8 & 255);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user