Skip to content

Commit 6f04818

Browse files
exec() now can return output
1 parent 5afa537 commit 6f04818

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

com/isoterminal/ISOTerminal.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,18 @@ ISOTerminal.addEventListener = (event,cb) => {
3434
ISOTerminal.listener[event].push(cb)
3535
}
3636

37-
ISOTerminal.prototype.exec = function(shellscript){
38-
this.send(`printf "\n\r"; ${shellscript}\n`,1)
37+
ISOTerminal.prototype.exec = function(opts){
38+
const shellscript = opts[0];
39+
const cb = opts[1];
40+
if( cb ){
41+
window.cb = cb
42+
this.send(`printf "\n\r"; ${shellscript} &> /mnt/exec; js '
43+
document.querySelector("[isoterminal]").emit("read_file", ["exec", window.cb ])
44+
';
45+
\n`,1)
46+
}else{
47+
this.send(`printf "\n\r"; ${shellscript} \n`,1)
48+
}
3949
}
4050

4151
ISOTerminal.prototype.hook = function(hookname,args){

0 commit comments

Comments
 (0)