Skip to content

Commit 50a994f

Browse files
.
1 parent 5d6a019 commit 50a994f

5 files changed

Lines changed: 29 additions & 17 deletions

File tree

package-lock.json

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@
3434
},
3535
"cordova-plugin-websocket": {},
3636
"cordova-plugin-buildinfo": {},
37-
"com.foxdebug.acode.rk.exec.terminal": {},
3837
"cordova-plugin-browser": {},
3938
"cordova-plugin-sftp": {},
4039
"cordova-plugin-system": {},
41-
"com.foxdebug.acode.rk.exec.proot": {}
40+
"com.foxdebug.acode.rk.exec.proot": {},
41+
"com.foxdebug.acode.rk.exec.terminal": {}
4242
},
4343
"platforms": [
4444
"android"
@@ -63,6 +63,7 @@
6363
"@types/url-parse": "^1.4.11",
6464
"autoprefixer": "^10.4.21",
6565
"babel-loader": "^10.0.0",
66+
"com.foxdebug.acode.rk.exec.proot": "file:src/plugins/proot",
6667
"com.foxdebug.acode.rk.exec.terminal": "file:src/plugins/terminal",
6768
"cordova-android": "^14.0.1",
6869
"cordova-clipboard": "^1.3.0",
@@ -128,4 +129,4 @@
128129
"yargs": "^18.0.0"
129130
},
130131
"browserslist": "cover 100%,not android < 5"
131-
}
132+
}

src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ async function onDeviceReady() {
178178

179179
system.requestPermission("android.permission.READ_EXTERNAL_STORAGE");
180180
system.requestPermission("android.permission.WRITE_EXTERNAL_STORAGE");
181+
system.requestPermission("android.permission.POST_NOTIFICATIONS");
181182

182183
const { versionCode } = BuildInfo;
183184

src/plugins/terminal/src/android/Executor.java

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import java.io.BufferedReader;
1616
import java.io.IOException;
17-
import java.io.InputStreamReader;
17+
import java.io.*;
1818
import java.io.OutputStream;
1919

2020
import java.util.Map;
@@ -281,16 +281,14 @@ private void isProcessRunning(String pid, CallbackContext callbackContext) {
281281
}
282282
}
283283

284-
285-
private void cleanupCallback(String id) {
286-
callbackContextMap.remove(id);
287-
}
288-
289-
@Override
290-
public void onDestroy() {
291-
super.onDestroy();
292-
Intent serviceIntent = new Intent(context, KeepAliveService.class);
293-
context.stopService(serviceIntent);
284+
private void streamOutput(InputStream inputStream, String pid, String streamType) {
285+
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
286+
String line;
287+
while ((line = reader.readLine()) != null) {
288+
sendPluginMessage(pid, streamType + ":" + line);
289+
}
290+
} catch (IOException ignored) {
291+
}
294292
}
295293

296294
private void sendPluginMessage(String pid, String message) {
@@ -302,9 +300,16 @@ private void sendPluginMessage(String pid, String message) {
302300
}
303301
}
304302

303+
@Override
304+
public void onDestroy() {
305+
super.onDestroy();
306+
//Intent serviceIntent = new Intent(context, KeepAliveService.class);
307+
//context.stopService(serviceIntent);
308+
}
309+
305310
private void cleanup(String pid) {
306311
processes.remove(pid);
307312
processInputs.remove(pid);
308313
processCallbacks.remove(pid);
309314
}
310-
}
315+
}

src/plugins/terminal/www/Executor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const Executor = {
3131

3232

3333
start(command,onData){
34-
this.start(command,onData,false)
34+
this.start(command,onData,true)
3535
},
3636

3737
start(command, onData, alpine) {

0 commit comments

Comments
 (0)