} else {
FileName fname = new FileName(cmdl.getStdInRedir());
if (fname.isRelative()) {
fname = new FileName(getEnvProperty("PWD")).absolutize(fname);
}
InputStreamBuffer bin = new InputStreamBuffer(new VFSInputStream(new SecureVFS(vfs, uctx), fname.toString()), cmdl.isInObjMode());
bin.setProperties(env);
in = bin;
}
} catch (IOException ex) {
throw new ShellException("Exception occured while initializing input buffer: " + ex.toString());
}
}
if (in == null) {
//log.debug("No output redirect setup...");
if (hasin) {
if (!"SINGLE".equals(getEnvProperty("TMODE"))) {
in = new BufferImpl();
} else {
in = new MemFileBufferImpl();
}
// here we set whatever is maxsize for inputbuffer for this executable - we have this set
// as attribute on the file or something ...
// FIXME
List input = cmdl.getStdInput();
if(input != null) {
in.setMaxSize(input.size());
try {
((Buffer)in).putBuffer(new LinkedList(input), 1000);
in.close();
} catch (IOException ex) {
throw new ShellException("Exception occured while initializing input buffer: " + ex.toString());
}
}
in.setMaxSize(inbufmax); // should be a variable
} else {
in = new NullBuffer();
}
}
} else {
//log.debug("Piping in previous out...");
Object o_in = ((Process) joblist.getLast()).getOutputBuffer();
if (!(o_in instanceof InBuffer)) {
throw new ShellException("Invalid pipe chain. Trying to read from write-only buffer.");
}
in = (InBuffer) o_in;
}
//log.debug("\n\nin = " + in);
OutBuffer out = null;
if (cmdl.size() == joblist.size() + 1) {
if (cmdl.getSLStdOutRedir() != null) {
try {
OutputStreamBuffer bout = new OutputStreamBuffer(new FileOutputStream(cmdl.getSLStdOutRedir(), cmdl.getSLAppend()), cmdl.isSLOutObjMode());
bout.setProperties(env);
out = bout;
p.setRedirected(true);
} catch (IOException ex) {
throw new ShellException("Exception occured while initializing output buffer: " + ex.toString());
}
} else if (cmdl.getStdOutRedir() != null) {
try {
////out=new OutputStreamBuffer(new VFSOutputStream(new SecureVFS(vfs, uctx), cmdl.getStdOutRedir(), cmdl.getAppend()), cmdl.isOutObjMode());
//if(TxSupport.isActive()) throw new ShellException("Illegal state - inside transaction.");
//TxSupport.begin();
try {
FileName fname = new FileName(cmdl.getStdOutRedir());
if (fname.isRelative()) {
fname = new FileName(getEnvProperty("PWD")).absolutize(fname);
}
OutputStreamBuffer bout = new OutputStreamBuffer(new LazyVFSOutputStream(new SecureVFS(vfs, uctx), fname.toString(), cmdl.getAppend()), cmdl.isOutObjMode());
bout.setProperties(env);
out = bout;
p.setRedirected(true);
//TxSupport.commit();
} catch (Exception ex) {