Skip to content

Commit ee24365

Browse files
use correct keyboard for process id
1 parent 9163d1e commit ee24365

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

src/pages/fileBrowser/fileBrowser.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,9 +1035,10 @@ function FileBrowserInclude(mode, info, doesOpenLast = true) {
10351035

10361036
// Check for Terminal Home Directory storage
10371037
try {
1038-
if (typeof Terminal !== "undefined" && Terminal.isInstalled) {
1038+
const isTerminalInstalled = await Terminal.isInstalled();
1039+
if (typeof Terminal !== "undefined" && isTerminalInstalled) {
10391040
const isTerminalSupported = await Terminal.isSupported();
1040-
const isTerminalInstalled = await Terminal.isInstalled();
1041+
10411042
if (isTerminalSupported && isTerminalInstalled) {
10421043
const terminalHomeUrl = cordova.file.dataDirectory + "alpine/home";
10431044

src/plugins/terminal/www/Executor.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const Executor = {
2323
* @example
2424
* Executor.start('sh', (type, data) => {
2525
* console.log(`[${type}] ${data}`);
26-
* }).then(pid => {
27-
* Executor.write(pid, 'echo Hello World');
28-
* Executor.stop(pid);
26+
* }).then(uuid => {
27+
* Executor.write(uuid, 'echo Hello World');
28+
* Executor.stop(uuid);
2929
* });
3030
*/
3131
start(command, onData) {
@@ -49,34 +49,34 @@ const Executor = {
4949
/**
5050
* Sends input to the stdin of a running process.
5151
*
52-
* @param {string} pid - The process ID returned by {@link Executor.start}.
52+
* @param {string} uuid - The process ID returned by {@link Executor.start}.
5353
* @param {string} input - The input string to send to the process.
5454
* @returns {Promise<string>} Resolves when the input is successfully written.
5555
*
5656
* @example
57-
* Executor.write(pid, 'ls /data');
57+
* Executor.write(uuid, 'ls /data');
5858
*/
59-
write(pid, input) {
59+
write(uuid, input) {
6060
return new Promise((resolve, reject) => {
61-
exec(resolve, reject, "Executor", "write", [pid, input]);
61+
exec(resolve, reject, "Executor", "write", [uuid, input]);
6262
});
6363
},
6464

6565
/**
6666
* Stops a running process.
6767
*
68-
* @param {string} pid - The process ID returned by {@link Executor.start}.
68+
* @param {string} uuid - The process ID returned by {@link Executor.start}.
6969
* @returns {Promise<string>} Resolves when the process is terminated.
7070
*
7171
* @example
72-
* Executor.stop(pid);
72+
* Executor.stop(uuid);
7373
*/
74-
stop(pid) {
74+
stop(uuid) {
7575
return new Promise((resolve, reject) => {
76-
exec(resolve, reject, "Executor", "stop", [pid]);
76+
exec(resolve, reject, "Executor", "stop", [uuid]);
7777
});
7878
},
79-
isRunning(pid) {
79+
isRunning(uuid) {
8080
return new Promise((resolve, reject) => {
8181
exec((result)=>{
8282
if(result === "running"){
@@ -86,7 +86,7 @@ const Executor = {
8686
}else{
8787
resolve(false)
8888
}
89-
}, reject, "Executor", "isRunning", [pid]);
89+
}, reject, "Executor", "isRunning", [uuid]);
9090
});
9191
},
9292

src/plugins/terminal/www/Terminal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,32 @@ const Terminal = {
1919

2020
Executor.start("sh", (type, data) => {
2121
logger(`${type} ${data}`);
22-
}).then(async (pid) => {
23-
await Executor.write(pid, `source ${filesDir}/init-sandbox.sh ${installing ? "--installing" : ""}; exit`);
22+
}).then(async (uuid) => {
23+
await Executor.write(uuid, `source ${filesDir}/init-sandbox.sh ${installing ? "--installing" : ""}; exit`);
2424
});
2525
})
2626

2727
},
2828

2929
async stopAxs(){
3030
// Initiate total annihilation (childrens included)
31-
await Executor.execute(`kill -KILL $(cat $PREFIX/pid)`)
31+
await Executor.execute(`kill -KILL $(cat $PREFIX/uuid)`)
3232
},
3333

3434
async isAxsRunning(){
3535
const filesDir = await new Promise((resolve, reject) => {
3636
system.getFilesDir(resolve, reject);
3737
});
3838
const pidExists = await new Promise((resolve, reject) => {
39-
system.fileExists(`${filesDir}/pid`, false, (result) => {
39+
system.fileExists(`${filesDir}/uuid`, false, (result) => {
4040
resolve(result == 1);
4141
}, reject);
4242
});
4343

4444
if(!pidExists){
4545
return false
4646
}
47-
const result = await Executor.execute(`kill -0 $(cat $PREFIX/pid) 2>/dev/null && echo "true" || echo "false"`)
47+
const result = await Executor.execute(`kill -0 $(cat $PREFIX/uuid) 2>/dev/null && echo "true" || echo "false"`)
4848
return result
4949
},
5050

0 commit comments

Comments
 (0)