mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
force our exit trap to always run (for rtnstate commands) (#556)
* add command validation to shellapi. mock out bash/zsh versions * implement validate command fn bash and zsh * test validate command * change rtnstate commands to always end with a builtin, so we always get our exit trap to run * simplify the rtnstate modification, don't add the 'wait' (as this is a different problem/feature) * update schema
This commit is contained in:
@@ -27,7 +27,7 @@ CREATE TABLE remote_instance (
|
||||
festate json NOT NULL,
|
||||
statebasehash varchar(36) NOT NULL,
|
||||
statediffhasharr json NOT NULL
|
||||
);
|
||||
, shelltype varchar(20) NOT NULL DEFAULT 'bash');
|
||||
CREATE TABLE state_base (
|
||||
basehash varchar(36) PRIMARY KEY,
|
||||
ts bigint NOT NULL,
|
||||
@@ -55,10 +55,8 @@ CREATE TABLE remote (
|
||||
lastconnectts bigint NOT NULL,
|
||||
local boolean NOT NULL,
|
||||
archived boolean NOT NULL,
|
||||
remoteidx int NOT NULL,
|
||||
statevars json NOT NULL DEFAULT '{}',
|
||||
sshconfigsrc varchar(36) NOT NULL DEFAULT 'waveterm-manual',
|
||||
openaiopts json NOT NULL DEFAULT '{}');
|
||||
remoteidx int NOT NULL
|
||||
, statevars json NOT NULL DEFAULT '{}', openaiopts json NOT NULL DEFAULT '{}', sshconfigsrc varchar(36) NOT NULL DEFAULT 'waveterm-manual', shellpref varchar(20) NOT NULL DEFAULT 'detect');
|
||||
CREATE TABLE history (
|
||||
historyid varchar(36) PRIMARY KEY,
|
||||
ts bigint NOT NULL,
|
||||
@@ -203,7 +201,7 @@ CREATE TABLE IF NOT EXISTS "cmd" (
|
||||
rtnstate boolean NOT NULL,
|
||||
rtnbasehash varchar(36) NOT NULL,
|
||||
rtndiffhasharr json NOT NULL,
|
||||
runout json NOT NULL,
|
||||
runout json NOT NULL, restartts bigint NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (screenid, lineid)
|
||||
);
|
||||
CREATE TABLE cmd_migrate20 (
|
||||
|
||||
@@ -1735,7 +1735,7 @@ func (msh *MShellProc) Launch(interactive bool) {
|
||||
msh.WriteToPtyBuffer("connected to %s\n", remoteCopy.RemoteCanonicalName)
|
||||
go func() {
|
||||
exitErr := cproc.Cmd.Wait()
|
||||
exitCode := shexec.GetExitCode(exitErr)
|
||||
exitCode := utilfn.GetExitCode(exitErr)
|
||||
msh.WithLock(func() {
|
||||
if msh.Status == StatusConnected || msh.Status == StatusConnecting {
|
||||
msh.Status = StatusDisconnected
|
||||
|
||||
Reference in New Issue
Block a user