wip fix
This commit is contained in:
parent
605757f7ee
commit
90566ec71e
|
|
@ -1,14 +1,14 @@
|
||||||
import { spawn } from "bun";
|
import { Subprocess, spawn } from "bun";
|
||||||
import { ExecaChildProcess, $ } from "execa";
|
import { $ } from "execa";
|
||||||
import { waitUntil } from "web-utils";
|
import { waitUntil } from "web-utils";
|
||||||
import { SAction } from "../actions";
|
import { SAction } from "../actions";
|
||||||
import { code } from "../editor/code/util-code";
|
import { code } from "../editor/code/util-code";
|
||||||
import { SyncConnection } from "../type";
|
|
||||||
import { snapshot } from "../entity/snapshot";
|
|
||||||
import { docs } from "../entity/docs";
|
import { docs } from "../entity/docs";
|
||||||
|
import { snapshot } from "../entity/snapshot";
|
||||||
|
import { SyncConnection } from "../type";
|
||||||
|
|
||||||
const code_startup = {
|
const code_startup = {
|
||||||
process: {} as Record<string, ExecaChildProcess>,
|
process: {} as Record<string, Subprocess>,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const code_action: SAction["code"]["action"] = async function (
|
export const code_action: SAction["code"]["action"] = async function (
|
||||||
|
|
@ -39,10 +39,11 @@ export const code_action: SAction["code"]["action"] = async function (
|
||||||
case "startup-run": {
|
case "startup-run": {
|
||||||
const cs = code_startup.process[arg.site_id];
|
const cs = code_startup.process[arg.site_id];
|
||||||
if (!cs) {
|
if (!cs) {
|
||||||
code_startup.process[arg.site_id] = $({
|
code_startup.process[arg.site_id] = spawn({
|
||||||
|
cmd: ["npm", "run", "startup"],
|
||||||
cwd: code.path(arg.site_id, "site", "src"),
|
cwd: code.path(arg.site_id, "site", "src"),
|
||||||
})`npm run startup`;
|
});
|
||||||
code_startup.process[arg.site_id].on("exit", () => {
|
code_startup.process[arg.site_id].exited.then(() => {
|
||||||
delete code_startup.process[arg.site_id];
|
delete code_startup.process[arg.site_id];
|
||||||
});
|
});
|
||||||
await waitUntil(1000);
|
await waitUntil(1000);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue