}
}
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) {
//TxSupport.rollback();
throw ex;
}
} catch (Exception ex) {
log.error("Exception occured while initializing output buffer: ", ex);
throw new ShellException("Exception occured while initializing output buffer: " + ex.toString());
}
}
}
//log.debug("\n\nout = " + out);
if (out == null) {
if (hasout) {
if (!"SINGLE".equals(getEnvProperty("TMODE"))) {
out = new BufferImpl();
} else {
out = 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
out.setMaxSize(outbufmax); // should be a variable
} else {
out = new NullBuffer();
}
if ((cmdl.size() == joblist.size() + 1) && ui && interactive) {
procmap.put(STDIN_ID, p);
outreader.replacePrimaryBuffer((InBuffer) out);