function [str,cleanup]=pipeout(cmd)
	fprintf('Starting sub-process: %s\n',cmd);
	process=java.lang.Runtime.getRuntime().exec({'bash','-c',cmd});
	str=process.getOutputStream();
	cleanup=@dispose;

	function dispose
		fprintf('Killing subprocess...\n');
		process.destroy();
	end
end
