mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-10-27 13:29:40 +00:00
Load scripts in memory
This commit is contained in:
@@ -9,6 +9,7 @@ import java.io.BufferedReader;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -132,6 +133,19 @@ public class Shell {
|
||||
return rootStatus > 0;
|
||||
}
|
||||
|
||||
public void loadInputStream(InputStream in) {
|
||||
try {
|
||||
int read;
|
||||
byte[] bytes = new byte[4096];
|
||||
while ((read = in.read(bytes)) != -1) {
|
||||
STDIN.write(bytes, 0, read);
|
||||
}
|
||||
STDIN.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> sh(String... commands) {
|
||||
List<String> res = new ArrayList<>();
|
||||
if (!isValid) return res;
|
||||
|
||||
Reference in New Issue
Block a user