From 6f0481830bbc880ba2210aa61aa752a184717b77 Mon Sep 17 00:00:00 2001 From: Leon van Kammen Date: Wed, 9 Apr 2025 20:48:10 +0200 Subject: [PATCH] exec() now can return output --- com/isoterminal/ISOTerminal.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/com/isoterminal/ISOTerminal.js b/com/isoterminal/ISOTerminal.js index 6b1b5af..90e0dfe 100644 --- a/com/isoterminal/ISOTerminal.js +++ b/com/isoterminal/ISOTerminal.js @@ -34,8 +34,18 @@ ISOTerminal.addEventListener = (event,cb) => { ISOTerminal.listener[event].push(cb) } -ISOTerminal.prototype.exec = function(shellscript){ - this.send(`printf "\n\r"; ${shellscript}\n`,1) +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) + } } ISOTerminal.prototype.hook = function(hookname,args){