pinokiod 3.8.128 → 3.8.130

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.
@@ -772,7 +772,7 @@ class Bin {
772
772
  // }
773
773
  //}
774
774
  console.timeEnd("### Total Install")
775
- await this.kernel.init()
775
+ await this.init()
776
776
  }
777
777
  async installed(r) {
778
778
  if (Array.isArray(r.name)) {
package/kernel/index.js CHANGED
@@ -536,13 +536,13 @@ class Kernel {
536
536
  }
537
537
 
538
538
  // // kill all processes just in case
539
- await new Promise((resolve, reject) => {
540
- console.log("killing child processes for", process.pid)
541
- kill(process.pid, {}, 'SIGKILL', () => {
542
- console.log("child procs killed for", process.pid)
543
- resolve()
544
- });
545
- })
539
+ // await new Promise((resolve, reject) => {
540
+ // console.log("killing child processes for", process.pid)
541
+ // kill(process.pid, {}, 'SIGKILL', () => {
542
+ // console.log("child procs killed for", process.pid)
543
+ // resolve()
544
+ // });
545
+ // })
546
546
 
547
547
  this.info = new Info(this)
548
548
  this.pipe = new Pipe(this)
package/kernel/shell.js CHANGED
@@ -2,7 +2,8 @@ const { Terminal } = require('xterm-headless');
2
2
  const { SerializeAddon } = require("xterm-addon-serialize");
3
3
  const sanitize = require("sanitize-filename");
4
4
  const YAML = require('yaml')
5
- const kill = require('./tree-kill');
5
+ //const kill = require('./tree-kill');
6
+ const kill = require('kill-sync')
6
7
  const fastq = require('fastq')
7
8
  const { v4: uuidv4 } = require('uuid');
8
9
  const os = require('os');
@@ -979,26 +980,42 @@ class Shell {
979
980
  this.queue.killAndDrain()
980
981
  if (this.ptyProcess) {
981
982
  if (cb) {
982
- let map = this.kernel.processes.map || {}
983
- kill(this.ptyProcess.pid, map, 'SIGKILL', () => {
984
- console.log("child procs killed for", this.ptyProcess.pid)
985
- this.ptyProcess.kill()
986
- this.ptyProcess = undefined
987
- // automatically remove the shell from this.kernel.shells
988
- this.kernel.shell.rm(this.id)
989
- this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
990
- console.log("before cb 1")
991
- cb()
992
- });
983
+ kill(this.ptyProcess.pid, "SIGKILL", true)
984
+ this.ptyProcess.kill()
985
+ this.ptyProcess = undefined
986
+ // automatically remove the shell from this.kernel.shells
987
+ this.kernel.shell.rm(this.id)
988
+ this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
989
+ console.log("before cb 1")
990
+ cb()
991
+
992
+ // let map = this.kernel.processes.map || {}
993
+ // kill(this.ptyProcess.pid, map, 'SIGKILL', () => {
994
+ // console.log("child procs killed for", this.ptyProcess.pid)
995
+ // this.ptyProcess.kill()
996
+ // this.ptyProcess = undefined
997
+ // // automatically remove the shell from this.kernel.shells
998
+ // this.kernel.shell.rm(this.id)
999
+ // this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
1000
+ // console.log("before cb 1")
1001
+ // cb()
1002
+ // });
993
1003
  } else {
994
- let map = this.kernel.processes.map || {}
995
- kill(this.ptyProcess.pid, map, 'SIGKILL');
996
- console.log("child procs killed for", this.ptyProcess.pid)
1004
+ kill(this.ptyProcess.pid, "SIGKILL", true)
997
1005
  this.ptyProcess.kill()
998
1006
  this.ptyProcess = undefined
999
1007
  // automatically remove the shell from this.kernel.shells
1000
1008
  this.kernel.shell.rm(this.id)
1001
1009
  this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
1010
+
1011
+ // let map = this.kernel.processes.map || {}
1012
+ // kill(this.ptyProcess.pid, map, 'SIGKILL');
1013
+ // console.log("child procs killed for", this.ptyProcess.pid)
1014
+ // this.ptyProcess.kill()
1015
+ // this.ptyProcess = undefined
1016
+ // // automatically remove the shell from this.kernel.shells
1017
+ // this.kernel.shell.rm(this.id)
1018
+ // this.ondata({ raw: `\r\n\r\n██ Terminated Shell ${this.id}\r\n████\r\n` })
1002
1019
  }
1003
1020
  } else {
1004
1021
  // // automatically remove the shell from this.kernel.shells
@@ -60,11 +60,11 @@ function killAll (tree, map, signal, callback) {
60
60
  killed[pidpid] = 1;
61
61
  }
62
62
  });
63
- // exception: if the pid is the current process,
64
- // kill all subprocesses, but do NOT kill the current process
65
- if (String(pid) === String(process.pid)) {
66
- return
67
- }
63
+ // // exception: if the pid is the current process,
64
+ // // kill all subprocesses, but do NOT kill the current process
65
+ // if (String(pid) === String(process.pid)) {
66
+ // return
67
+ // }
68
68
  if (!killed[pid]) {
69
69
  killPid(pid, map, signal);
70
70
  killed[pid] = 1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.8.128",
3
+ "version": "3.8.130",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -40,6 +40,7 @@
40
40
  "jimini": "^0.0.7",
41
41
  "jsdom": "^24.0.0",
42
42
  "key-store": "^1.2.0",
43
+ "kill-sync": "^1.0.3",
43
44
  "kleur": "^4.1.5",
44
45
  "lodash": "^4.17.21",
45
46
  "marked": "^5.0.1",
package/server/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  const express = require('express');
2
- const kill = require('../kernel/tree-kill');
2
+ //const kill = require('../kernel/tree-kill');
3
+ const kill = require('kill-sync')
3
4
  const portfinder = require('portfinder-cp');
4
5
  const proxy = require('express-http-proxy-cp');
5
6
  const sudo = require("sudo-prompt-programfiles-x86");
@@ -3955,10 +3956,11 @@ class Server {
3955
3956
  // process.exit()
3956
3957
  //}
3957
3958
  let map = this.kernel.processes.map || {}
3958
- kill(process.pid, map, 'SIGKILL', () => {
3959
- console.log("child procs killed for", process.pid)
3960
- process.exit()
3961
- });
3959
+ kill(process.pid, 'SIGKILL', true)
3960
+ //kill(process.pid, map, 'SIGKILL', () => {
3961
+ // console.log("child procs killed for", process.pid)
3962
+ // process.exit()
3963
+ //});
3962
3964
  })
3963
3965
 
3964
3966
  process.on('SIGTERM', () => {
@@ -3971,19 +3973,21 @@ class Server {
3971
3973
  // } else {
3972
3974
  // process.exit()
3973
3975
  // }
3974
- let map = this.kernel.processes.map || {}
3975
- kill(process.pid, map, 'SIGKILL', () => {
3976
- console.log("child procs killed for", process.pid)
3977
- process.exit()
3978
- });
3976
+ kill(process.pid, 'SIGKILL', true)
3977
+ //let map = this.kernel.processes.map || {}
3978
+ //kill(process.pid, map, 'SIGKILL', () => {
3979
+ // console.log("child procs killed for", process.pid)
3980
+ // process.exit()
3981
+ //});
3979
3982
  })
3980
3983
  process.on('exit', () => {
3981
3984
  console.log("[Exit event]")
3982
- let map = this.kernel.processes.map || {}
3983
- kill(process.pid, map, 'SIGKILL', () => {
3984
- console.log("child procs killed for", process.pid)
3985
- process.exit()
3986
- });
3985
+ kill(process.pid, 'SIGKILL', true)
3986
+ //let map = this.kernel.processes.map || {}
3987
+ //kill(process.pid, map, 'SIGKILL', () => {
3988
+ // console.log("child procs killed for", process.pid)
3989
+ // process.exit()
3990
+ //});
3987
3991
  })
3988
3992
  // process.on('exit', () => {
3989
3993
  // console.log("exit Event")