C
charly
Hi !
I'm working on a website which can generate a dump of a database. I
generate csv files then tar and zip them and redirect the browser to the
file.
The problem is that I cannot get out of the process I create :
String dest ="/bin/tar -cz " + SaveDir + "*.csv -f " + SaveDir + nomZip
+ " & exit";
String[] commande = { "/bin/bash", "-c", dest };
System.out.println(" Saving...);
Process process = Runtime.getRuntime().exec(commande);
/*BufferedReader inputreader =
new BufferedReader(
new InputStreamReader(process.getInputStream()));
BufferedReader errorreader =
new BufferedReader(
new InputStreamReader(process.getErrorStream()));
String readerdata;
while ((readerdata = inputreader.readLine()) != null) {
System.out.println("On stdout: " + readerdata);
}
while ((readerdata = errorreader.readLine()) != null) {
System.out.println("On stderr: " + readerdata);
}*/
But Tomcat tells me : process hasn't exited
But I issued a exit command so what's happening ?
Hope to get some help from you folks
I'm working on a website which can generate a dump of a database. I
generate csv files then tar and zip them and redirect the browser to the
file.
The problem is that I cannot get out of the process I create :
String dest ="/bin/tar -cz " + SaveDir + "*.csv -f " + SaveDir + nomZip
+ " & exit";
String[] commande = { "/bin/bash", "-c", dest };
System.out.println(" Saving...);
Process process = Runtime.getRuntime().exec(commande);
/*BufferedReader inputreader =
new BufferedReader(
new InputStreamReader(process.getInputStream()));
BufferedReader errorreader =
new BufferedReader(
new InputStreamReader(process.getErrorStream()));
String readerdata;
while ((readerdata = inputreader.readLine()) != null) {
System.out.println("On stdout: " + readerdata);
}
while ((readerdata = errorreader.readLine()) != null) {
System.out.println("On stderr: " + readerdata);
}*/
But Tomcat tells me : process hasn't exited
But I issued a exit command so what's happening ?
Hope to get some help from you folks