mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-23 19:31:30 +00:00
Fixed syncthing restart (fixes #137).
This commit is contained in:
parent
235eb39c23
commit
c588604ba8
1 changed files with 15 additions and 12 deletions
|
@ -48,6 +48,8 @@ public class SyncthingRunnable implements Runnable {
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
Process process = null;
|
Process process = null;
|
||||||
try {
|
try {
|
||||||
|
// Loop to handle syncthing restarts (these always have an error code of 3).
|
||||||
|
do {
|
||||||
process = Runtime.getRuntime().exec("sh");
|
process = Runtime.getRuntime().exec("sh");
|
||||||
dos = new DataOutputStream(process.getOutputStream());
|
dos = new DataOutputStream(process.getOutputStream());
|
||||||
// Set home directory to data folder for syncthing to use.
|
// Set home directory to data folder for syncthing to use.
|
||||||
|
@ -62,6 +64,7 @@ public class SyncthingRunnable implements Runnable {
|
||||||
log(process.getInputStream());
|
log(process.getInputStream());
|
||||||
|
|
||||||
ret = process.waitFor();
|
ret = process.waitFor();
|
||||||
|
} while (ret == 3);
|
||||||
} catch (IOException | InterruptedException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
Log.e(TAG, "Failed to execute syncthing binary or read output", e);
|
Log.e(TAG, "Failed to execute syncthing binary or read output", e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in a new issue