mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-13 06:26:05 +09:00
command.js: pipe flushing after execution
appexec.js: vdisk mounting
This commit is contained in:
@@ -107,6 +107,27 @@ for (let i = 0; i < sectionTable.length - 1; i++) {
|
|||||||
|
|
||||||
files.open(PATH_MOUNT + "run.com").swrite(rodataSnippet+program)
|
files.open(PATH_MOUNT + "run.com").swrite(rodataSnippet+program)
|
||||||
}
|
}
|
||||||
|
else if ("VDISK" == sectName) {
|
||||||
|
let bytes = btostr(decompFun(compPayload))
|
||||||
|
// unpack vdisk
|
||||||
|
if (bytes.substring(0, 9) != "TVDOSLFS\x01") {
|
||||||
|
printerrln("VDISK is not LFS")
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
let curs = 16
|
||||||
|
while (curs < bytes.length) {
|
||||||
|
let fileType = bytes.charCodeAt(curs)
|
||||||
|
let pathlen = (bytes.charCodeAt(curs+1) << 8) | bytes.charCodeAt(curs+2)
|
||||||
|
curs += 3
|
||||||
|
let path = bytes.substring(curs, curs + pathlen)
|
||||||
|
curs += pathlen
|
||||||
|
let filelen = (bytes.charCodeAt(curs) << 24) | (bytes.charCodeAt(curs+1) << 16) | (bytes.charCodeAt(curs+2) << 8) | bytes.charCodeAt(curs+3)
|
||||||
|
curs += 4
|
||||||
|
let filebytes = bytes.substring(curs, curs + filelen)
|
||||||
|
files.open(`${PATH_MOUNT}${path}`).swrite(filebytes)
|
||||||
|
curs += filelen
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let errorlevel = _G.shell.execute(PATH_MOUNT + "run.com")
|
let errorlevel = _G.shell.execute(PATH_MOUNT + "run.com")
|
||||||
|
|||||||
@@ -798,7 +798,7 @@ _TVDOS.DRV.FS.DEVTMP.mkDir = (fd) => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
_TVDOS.DRV.FS.DEVTMP.mkFile = (fd) => {
|
_TVDOS.DRV.FS.DEVTMP.mkFile = (fd) => {
|
||||||
_TVDOS.TMPFS[fd.path] = new PmemFSfile(fd.path)
|
_TVDOS.TMPFS[fd.path] = new PmemFSfile("")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
_TVDOS.DRV.FS.DEVTMP.remove = (fd) => {
|
_TVDOS.DRV.FS.DEVTMP.remove = (fd) => {
|
||||||
|
|||||||
@@ -802,6 +802,10 @@ shell.execute = function(line) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
serial.println("[shell.execute] final retvalue: "+retValue)
|
serial.println("[shell.execute] final retvalue: "+retValue)
|
||||||
|
|
||||||
|
// flush pipes
|
||||||
|
while (1) { if (undefined === shell.removePipe()) break }
|
||||||
|
|
||||||
return retValue
|
return retValue
|
||||||
}
|
}
|
||||||
shell.pipes = {} // syntax: _G.shell.pipes[name] = contents; all pipes are named pipes just like in Windows
|
shell.pipes = {} // syntax: _G.shell.pipes[name] = contents; all pipes are named pipes just like in Windows
|
||||||
|
|||||||
Reference in New Issue
Block a user