mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-16 03:24:31 +02:00
Read backup output async
This commit is contained in:
@@ -91,8 +91,7 @@ public class Backup implements Runnable
|
|||||||
server.dispatchCommand(cs, "save-all");
|
server.dispatchCommand(cs, "save-all");
|
||||||
server.dispatchCommand(cs, "save-off");
|
server.dispatchCommand(cs, "save-off");
|
||||||
|
|
||||||
ess.runTaskAsynchronously(
|
ess.runTaskAsynchronously(new Runnable()
|
||||||
new Runnable()
|
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
@@ -103,10 +102,16 @@ public class Backup implements Runnable
|
|||||||
childBuilder.redirectErrorStream(true);
|
childBuilder.redirectErrorStream(true);
|
||||||
childBuilder.directory(ess.getDataFolder().getParentFile().getParentFile());
|
childBuilder.directory(ess.getDataFolder().getParentFile().getParentFile());
|
||||||
final Process child = childBuilder.start();
|
final Process child = childBuilder.start();
|
||||||
|
ess.runTaskAsynchronously(new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(child.getInputStream()));
|
final BufferedReader reader = new BufferedReader(new InputStreamReader(child.getInputStream()));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
child.waitFor();
|
|
||||||
String line;
|
String line;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@@ -123,6 +128,14 @@ public class Backup implements Runnable
|
|||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.SEVERE, null, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
child.waitFor();
|
||||||
|
}
|
||||||
catch (InterruptedException ex)
|
catch (InterruptedException ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, null, ex);
|
LOGGER.log(Level.SEVERE, null, ex);
|
||||||
@@ -133,8 +146,7 @@ public class Backup implements Runnable
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
ess.scheduleSyncDelayedTask(
|
ess.scheduleSyncDelayedTask(new Runnable()
|
||||||
new Runnable()
|
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
|
Reference in New Issue
Block a user