Skip to content

Commit c861585

Browse files
fix. stopAxs not working
1 parent ac1651e commit c861585

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

src/plugins/terminal/scripts/init-sandbox.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
echo "$$" > $PREFIX/pid
2+
13
export LD_LIBRARY_PATH=$PREFIX
24
export PROOT_TMP_DIR=$PREFIX/tmp
35

@@ -25,4 +27,4 @@ else
2527
fi
2628

2729

28-
$PROOT -b $PREFIX:$PREFIX -b /data:/data -b /system:/system -b /vendor:/vendor -S $PREFIX/alpine /bin/sh $PREFIX/init-alpine.sh "$@"
30+
$PROOT -b $PREFIX:$PREFIX -b /data:/data -b /system:/system -b /vendor:/vendor -b /sdcard:/sdcard -b /storage:/storage -S $PREFIX/alpine /bin/sh $PREFIX/init-alpine.sh "$@"

src/plugins/terminal/www/Terminal.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ const Terminal = {
1818
system.writeText(`${filesDir}/init-sandbox.sh`,content,logger,err_logger)
1919

2020
Executor.start("sh", (type, data) => {
21-
logger(data);
21+
logger(`${type} ${data}`);
2222
}).then(async (pid) => {
23-
system.writeText(`${filesDir}/pid`,pid,logger,err_logger)
2423
await Executor.write(pid, `source ${filesDir}/init-sandbox.sh ${installing ? "--installing" : ""}; exit`);
2524
});
2625
})
@@ -30,21 +29,10 @@ const Terminal = {
3029
async stopAxs(){
3130
const filesDir = await new Promise((resolve, reject) => {
3231
system.getFilesDir(resolve, reject);
33-
});
34-
const pidExists = await new Promise((resolve, reject) => {
35-
system.fileExists(`${filesDir}/pid`, false, (result) => {
36-
resolve(result == 1);
37-
}, reject);
38-
});
39-
40-
if(pidExists){
41-
const filesDir = await new Promise((resolve, reject) => {
42-
system.getFilesDir(resolve, reject);
43-
});
44-
const pid = await Executor.execute(`cat ${filesDir}/pid`)
45-
Executor.stop(pid)
46-
}
32+
});
4733

34+
// Initiate total annihilation, burn it all, childrens included
35+
await Executor.execute(`kill -TERM -- -$(cat ${filesDir}/pid)`)
4836
},
4937

5038
async isAxsRunning(){

0 commit comments

Comments
 (0)