@intuned/runtime-dev 1.1.6-vnc.2 → 1.1.6-vnc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -246,6 +246,20 @@ if (require.main === module) {
246
246
  }
247
247
  const processes = [];
248
248
  async function startVncServer() {
249
+ function listenToProcess(process, name) {
250
+ process.stdout?.on("data", data => {
251
+ console.log(`[${name} ]${data}`);
252
+ });
253
+ process.stderr?.on("data", data => {
254
+ console.error(`[${process.pid}-E]${data}`);
255
+ });
256
+ process.on("error", error => {
257
+ console.error(`${name} error: ${error}`);
258
+ });
259
+ process.on("exit", (code, signal) => {
260
+ console.log(`${name} exited with code ${code} and signal ${signal}`);
261
+ });
262
+ }
249
263
  try {
250
264
  const vncLockPath = "/tmp/.X99-lock";
251
265
  if (await fs.exists(vncLockPath)) {
@@ -258,40 +272,41 @@ async function startVncServer() {
258
272
  } catch (error) {
259
273
  console.error("Error cleaning up VNC locks:", error);
260
274
  }
275
+ console.log("Starting VNC server...");
276
+ console.log("Spawning openbox");
261
277
  const openboxProcess = (0, _child_process.spawn)("openbox");
278
+ listenToProcess(openboxProcess, "openbox");
262
279
  processes.push(openboxProcess);
280
+ console.log("Spawning devilspie");
263
281
  const devilspieProcess = (0, _child_process.spawn)("devilspie");
282
+ listenToProcess(devilspieProcess, "devilspie");
264
283
  processes.push(devilspieProcess);
284
+ console.log("Spawning xsetroot");
265
285
  const xSetRootProcess = (0, _child_process.spawn)("xsetroot", ["-solid", "#000000"]);
286
+ listenToProcess(xSetRootProcess, "xsetroot");
266
287
  processes.push(xSetRootProcess);
288
+ console.log("Setting up vnc startup script");
267
289
  const vncStartupScript = "exec xclock -digital -update 0 -bg black";
268
290
  await fs.writeFile("/tmp/vnc_startup.sh", vncStartupScript, {
269
291
  mode: 0o755
270
292
  });
293
+ console.log("Spawning vncserver");
271
294
  const vncServerProcess = (0, _child_process.spawn)("vncserver", [":99", "-localhost", "yes", "-rfbauth", "/root/vnc/passwd", "-rfbport", "5900", "-geometry", "1280x720"]);
295
+ listenToProcess(vncServerProcess, "vncserver");
272
296
  processes.push(vncServerProcess);
297
+ console.log("Waiting for VNC server to start...");
273
298
  while (true) {
274
299
  if (await fs.exists("/tmp/.X11-unix/X99")) {
275
300
  break;
276
301
  }
302
+ console.log("VNC server not ready yet, waiting...");
277
303
  await (0, _promises.setTimeout)(1000);
278
304
  }
305
+ console.log("VNC server started successfully");
306
+ console.log("Spawning noVNC server...");
279
307
  const noVncProcess = (0, _child_process.spawn)("/opt/bin/noVNC/utils/launch.sh", ["--listen", "6080", "--vnc", "localhost:5900"]);
308
+ listenToProcess(noVncProcess, "noVNC");
280
309
  processes.push(noVncProcess);
281
- for (const process of processes) {
282
- process.stdout?.on("data", data => {
283
- console.log(`Process ${process.pid} stdout: ${data}`);
284
- });
285
- process.stderr?.on("data", data => {
286
- console.error(`Process ${process.pid} stderr: ${data}`);
287
- });
288
- process.on("error", error => {
289
- console.error(`Process ${process.pid} error: ${error}`);
290
- });
291
- process.on("exit", (code, signal) => {
292
- console.log(`Process ${process.pid} exited with code ${code} and signal ${signal}`);
293
- });
294
- }
295
310
  }
296
311
  async function stopVncServer() {
297
312
  for (const process of processes.reverse()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intuned/runtime-dev",
3
- "version": "1.1.6-vnc.2",
3
+ "version": "1.1.6-vnc.3",
4
4
  "description": "Intuned runtime",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",