pinokiod 3.4.11 → 3.4.12

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server/index.js +23 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.4.11",
3
+ "version": "3.4.12",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2023,34 +2023,30 @@ class Server {
2023
2023
  }
2024
2024
  if (homedir) {
2025
2025
  console.log({ homedir })
2026
- let exists = await this.exists(homedir)
2027
- console.log( { exists })
2028
- if (exists) {
2029
- let logsdir = path.resolve(homedir, "logs")
2030
- console.log({ logsdir })
2031
- await fs.promises.mkdir(logsdir, { recursive: true }).catch((e) => { console.log(e) })
2032
- console.log("this.log", this.log)
2033
- if (!this.log) {
2034
- this.log = fs.createWriteStream(path.resolve(homedir, "logs/stdout.txt"))
2035
- console.log("created this.log", this.log)
2036
- process.stdout.write = process.stderr.write = this.log.write.bind(this.log)
2037
- process.on('uncaughtException', (err) => {
2038
- console.error((err && err.stack) ? err.stack : err);
2039
- });
2040
- this.logInterval = setInterval(async () => {
2041
- try {
2042
- let file = path.resolve(homedir, "logs/stdout.txt")
2043
- let data = await fs.promises.readFile(file, 'utf8')
2044
- let lines = data.split('\n')
2045
- if (lines.length > 100000) {
2046
- let str = lines.slice(-100000).join("\n")
2047
- await fs.promises.writeFile(file, str)
2048
- }
2049
- } catch (e) {
2050
- console.log("Log Error", e)
2026
+ let logsdir = path.resolve(homedir, "logs")
2027
+ console.log({ logsdir })
2028
+ await fs.promises.mkdir(logsdir, { recursive: true }).catch((e) => { console.log(e) })
2029
+ console.log("this.log", this.log)
2030
+ if (!this.log) {
2031
+ this.log = fs.createWriteStream(path.resolve(homedir, "logs/stdout.txt"))
2032
+ console.log("created this.log", this.log)
2033
+ process.stdout.write = process.stderr.write = this.log.write.bind(this.log)
2034
+ process.on('uncaughtException', (err) => {
2035
+ console.error((err && err.stack) ? err.stack : err);
2036
+ });
2037
+ this.logInterval = setInterval(async () => {
2038
+ try {
2039
+ let file = path.resolve(homedir, "logs/stdout.txt")
2040
+ let data = await fs.promises.readFile(file, 'utf8')
2041
+ let lines = data.split('\n')
2042
+ if (lines.length > 100000) {
2043
+ let str = lines.slice(-100000).join("\n")
2044
+ await fs.promises.writeFile(file, str)
2051
2045
  }
2052
- }, 1000 * 60 * 10) // 10 minutes
2053
- }
2046
+ } catch (e) {
2047
+ console.log("Log Error", e)
2048
+ }
2049
+ }, 1000 * 60 * 10) // 10 minutes
2054
2050
  }
2055
2051
  }
2056
2052
  }