exec() now can return output
This commit is contained in:
parent
5afa537069
commit
6f0481830b
1 changed files with 12 additions and 2 deletions
|
|
@ -34,9 +34,19 @@ ISOTerminal.addEventListener = (event,cb) => {
|
||||||
ISOTerminal.listener[event].push(cb)
|
ISOTerminal.listener[event].push(cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
ISOTerminal.prototype.exec = function(shellscript){
|
ISOTerminal.prototype.exec = function(opts){
|
||||||
|
const shellscript = opts[0];
|
||||||
|
const cb = opts[1];
|
||||||
|
if( cb ){
|
||||||
|
window.cb = cb
|
||||||
|
this.send(`printf "\n\r"; ${shellscript} &> /mnt/exec; js '
|
||||||
|
document.querySelector("[isoterminal]").emit("read_file", ["exec", window.cb ])
|
||||||
|
';
|
||||||
|
\n`,1)
|
||||||
|
}else{
|
||||||
this.send(`printf "\n\r"; ${shellscript} \n`,1)
|
this.send(`printf "\n\r"; ${shellscript} \n`,1)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ISOTerminal.prototype.hook = function(hookname,args){
|
ISOTerminal.prototype.hook = function(hookname,args){
|
||||||
let cmd = `{ type hook || source /etc/profile.sh; }; hook ${hookname} "${args.join('" "')}"`
|
let cmd = `{ type hook || source /etc/profile.sh; }; hook ${hookname} "${args.join('" "')}"`
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue