mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-25 16:09:44 +00:00
Read backup output async
This commit is contained in:
parent
32b118d3c0
commit
52c3169a3c
1 changed files with 62 additions and 50 deletions
|
@ -91,8 +91,7 @@ public class Backup implements Runnable
|
|||
server.dispatchCommand(cs, "save-all");
|
||||
server.dispatchCommand(cs, "save-off");
|
||||
|
||||
ess.runTaskAsynchronously(
|
||||
new Runnable()
|
||||
ess.runTaskAsynchronously(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
|
@ -103,10 +102,16 @@ public class Backup implements Runnable
|
|||
childBuilder.redirectErrorStream(true);
|
||||
childBuilder.directory(ess.getDataFolder().getParentFile().getParentFile());
|
||||
final Process child = childBuilder.start();
|
||||
ess.runTaskAsynchronously(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(child.getInputStream()));
|
||||
try
|
||||
{
|
||||
child.waitFor();
|
||||
String line;
|
||||
do
|
||||
{
|
||||
|
@ -123,6 +128,14 @@ public class Backup implements Runnable
|
|||
reader.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
child.waitFor();
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
LOGGER.log(Level.SEVERE, null, ex);
|
||||
|
@ -133,8 +146,7 @@ public class Backup implements Runnable
|
|||
}
|
||||
finally
|
||||
{
|
||||
ess.scheduleSyncDelayedTask(
|
||||
new Runnable()
|
||||
ess.scheduleSyncDelayedTask(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
|
|
Loading…
Reference in a new issue