The problem here was found, when I realized it was trying to write some binary files that didn't exist :s
Android InputStream from ProcessBuilder: readLine() returns null
-
28-09-2022 - |
Frage
I am building an Android app based on: https://code.google.com/p/ics-openvpn/ However, after signing and exporting, some of the original code is not working:
private void startOpenVPNThreadArgs(String[] argv, Map<String, String> env) {
LinkedList<String> argvlist = new LinkedList<String>();
Collections.addAll(argvlist, argv);
ProcessBuilder pb = new ProcessBuilder(argvlist);
// Hack O rama
String lbpath = genLibraryPath(argv, pb);
pb.environment().put("LD_LIBRARY_PATH", lbpath);
// Add extra variables
for(Entry<String,String> e:env.entrySet()){
pb.environment().put(e.getKey(), e.getValue());
}
pb.redirectErrorStream(true);
try {
mProcess = pb.start();
// Close the output, since we don't need it
mProcess.getOutputStream().close();
InputStream in = mProcess.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while(true) {
String logline = br.readLine();
if(logline==null) {
System.out.println("logline == null");
return;
}
etc.
I keep getting getting: logline == null
, and then the connection is broken. No exceptions
The argument env is an Empty Map!
This is all original code, and I really don't know where to look, since there is no comment or JavaDoc. Can anyone help me out with this?
Thanks
Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow