bugfix: properly escape exec command-strings
All checks were successful
/ mirror_to_github (push) Successful in 28s
/ test (push) Successful in 7s

This commit is contained in:
Leon van Kammen 2025-04-18 15:22:23 +02:00
parent 9d549454d6
commit c79af592e6

View file

@ -37,15 +37,12 @@ ISOTerminal.addEventListener = (event,cb) => {
ISOTerminal.prototype.exec = function(opts){ ISOTerminal.prototype.exec = function(opts){
const shellscript = opts[0]; const shellscript = opts[0];
const cb = opts[1]; const cb = opts[1];
let cmd = `printf "\n\r"; { sh<<EOF\n ${shellscript}; \nEOF\n} &> /mnt/exec;\n`
if( cb ){ if( cb ){
window.cb = cb window.cb = cb
this.send(`printf "\n\r"; ${shellscript} &> /mnt/exec; js ' cmd += `js 'document.querySelector("[isoterminal]").emit("read_file", ["exec", window.cb ])';\n`
document.querySelector("[isoterminal]").emit("read_file", ["exec", window.cb ])
';
\n`,1)
}else{
this.send(`printf "\n\r"; ${shellscript} \n`,1)
} }
this.send( cmd, 1 )
} }
ISOTerminal.prototype.hook = function(hookname,args){ ISOTerminal.prototype.hook = function(hookname,args){