From b92d7049fe57006ba3b65942d4213ee89e7b4b3d Mon Sep 17 00:00:00 2001 From: cgeek <cem.moreau@gmail.com> Date: Sat, 5 Jun 2021 17:58:13 +0200 Subject: [PATCH] feat: disable unix specific code --- Cargo.lock | 46 -- Cargo.toml | 4 +- README.md | 7 + package-lock.json | 706 +++++++++++++++++++++++++++- package.json | 2 +- rust-bins/duniter-cli/src/daemon.rs | 200 ++++---- rust-bins/duniter-cli/src/main.rs | 50 +- 7 files changed, 834 insertions(+), 181 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 47e2f42b2..7a6ef23e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -593,17 +593,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "daemonize-me" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "078464a47febb5786c43fc1f65fd1a58dae38f0544912dd855cbdde2e2bdf197" -dependencies = [ - "libc", - "nix 0.17.0", - "snafu", -] - [[package]] name = "darling" version = "0.10.2" @@ -778,12 +767,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - [[package]] name = "dubp" version = "0.57.0" @@ -935,12 +918,10 @@ version = "1.8.1" dependencies = [ "anyhow", "ctrlc", - "daemonize-me", "dirs", "duniter-core", "duniter-gva-conf", "log", - "logwatcher", "nix 0.17.0", "read_input", "rusty-hook", @@ -1920,12 +1901,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "logwatcher" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d0925aed5b12ed59857f438d25a910cf051dbcd4107907be1e7abf6c44ec903" - [[package]] name = "maplit" version = "1.0.2" @@ -2891,27 +2866,6 @@ dependencies = [ "serde", ] -[[package]] -name = "snafu" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" -dependencies = [ - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "socket2" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index f3b123ba7..9d138c82f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,11 +16,11 @@ name = "duniter" [dependencies] anyhow = "1.0.32" ctrlc = "3.1.6" -daemonize-me = "0.3.1" +#daemonize-me = "0.3.1" dirs = "3.0.1" duniter-core = { git = "https://git.duniter.org/nodes/rust/duniter-core", features = ["bc-writer"] } log = "0.4.11" -logwatcher = "0.1.1" +#logwatcher = "0.1.1" nix = "0.17.0" read_input = "0.8.4" serde_json = "1.0.53" diff --git a/README.md b/README.md index 69e0b915e..980d3a263 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,13 @@ cargo xtask build ./target/release/duniter start ``` +##### For Windows + +1. Install Visual Studio 2019 for C++ development +1. Install cmake (best: the .msi, select add to path "For all users") +2. Use `feature/dev-on-windows` branch +3. Install NodeJS v10.22.1 + ### Documentation Visit [Duniter website](https://duniter.org): it gathers theoretical informations, FAQ and several useful links. If you want to learn, this is the first place to visit. diff --git a/package-lock.json b/package-lock.json index df1f95868..6b3280136 100644 --- a/package-lock.json +++ b/package-lock.json @@ -347,6 +347,11 @@ "integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==", "dev": true }, + "adm-zip": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.7.tgz", + "integrity": "sha1-hgbCy/HEJs6MjsABdER/1Jtur8E=" + }, "agent-base": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz", @@ -663,6 +668,14 @@ } } }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "requires": { + "inherits": "~2.0.0" + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -700,6 +713,14 @@ } } }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "requires": { + "hoek": "2.x.x" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -918,6 +939,11 @@ "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", "dev": true }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, "code-point-at": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", @@ -1020,6 +1046,14 @@ "typedarray": "^0.0.6" } }, + "connect-busboy": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/connect-busboy/-/connect-busboy-0.0.2.tgz", + "integrity": "sha1-rFyclmchcYheV2xmsr/ZXTuxEJc=", + "requires": { + "busboy": "*" + } + }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", @@ -1145,6 +1179,14 @@ "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", "integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=" }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "requires": { + "boom": "2.x.x" + } + }, "cycle": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz", @@ -1180,7 +1222,6 @@ "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, "requires": { "ms": "2.0.0" }, @@ -1188,8 +1229,7 @@ "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" } } }, @@ -1289,6 +1329,519 @@ } } }, + "duniter-ui": { + "version": "1.7.14", + "resolved": "https://registry.npmjs.org/duniter-ui/-/duniter-ui-1.7.14.tgz", + "integrity": "sha512-K6qXZY+Y5tlpaNo2gbJDGKwv/frGsUrIAVD1+3F25Glnw5m8PLCKNATEd9JRXcJxjr8BJ7noZWNfMc83lgJs2g==", + "requires": { + "adm-zip": "0.4.7", + "body-parser": "1.17.1", + "co": "4.6.0", + "cors": "2.8.2", + "event-stream": "3.3.4", + "express": "4.15.2", + "express-fileupload": "0.0.5", + "fs-extra": "2.1.2", + "materialize-css": "0.98.1", + "moment": "2.18.1", + "node-pre-gyp": "0.6.34", + "q": "1.5.0", + "request": "2.81.0", + "request-promise": "4.2.0", + "rimraf": "2.6.1", + "tmp": "0.0.31", + "underscore": "1.8.3" + }, + "dependencies": { + "ajv": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "requires": { + "co": "^4.6.0", + "json-stable-stringify": "^1.0.1" + } + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=" + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=" + }, + "body-parser": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.17.1.tgz", + "integrity": "sha1-dbO8mN3W5+DY/+dQ36ylxmmT+kc=", + "requires": { + "bytes": "2.4.0", + "content-type": "~1.0.2", + "debug": "2.6.1", + "depd": "~1.1.0", + "http-errors": "~1.6.1", + "iconv-lite": "0.4.15", + "on-finished": "~2.3.0", + "qs": "6.4.0", + "raw-body": "~2.2.0", + "type-is": "~1.6.14" + } + }, + "bytes": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-2.4.0.tgz", + "integrity": "sha1-fZcZb51br39pNeJZhVSe3SpsIzk=" + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cors": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.2.tgz", + "integrity": "sha1-Omwx9aOYyHOU4xVVtifqNSODkIA=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "debug": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.1.tgz", + "integrity": "sha1-eYVQkLosTjEVzH2HaUkdWPBJE1E=", + "requires": { + "ms": "0.7.2" + } + }, + "event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "requires": { + "duplexer": "~0.1.1", + "from": "~0", + "map-stream": "~0.1.0", + "pause-stream": "0.0.11", + "split": "0.3", + "stream-combiner": "~0.0.4", + "through": "~2.3.1" + } + }, + "express": { + "version": "4.15.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.15.2.tgz", + "integrity": "sha1-rxB/wUhQRFfy3Kmm8lcdcSm5ezU=", + "requires": { + "accepts": "~1.3.3", + "array-flatten": "1.1.1", + "content-disposition": "0.5.2", + "content-type": "~1.0.2", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.1", + "depd": "~1.1.0", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.0", + "finalhandler": "~1.0.0", + "fresh": "0.5.0", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.1", + "path-to-regexp": "0.1.7", + "proxy-addr": "~1.1.3", + "qs": "6.4.0", + "range-parser": "~1.2.0", + "send": "0.15.1", + "serve-static": "1.12.1", + "setprototypeof": "1.0.3", + "statuses": "~1.3.1", + "type-is": "~1.6.14", + "utils-merge": "1.0.0", + "vary": "~1.1.0" + }, + "dependencies": { + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "express-fileupload": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/express-fileupload/-/express-fileupload-0.0.5.tgz", + "integrity": "sha1-QzpxJSWvqYtMkxYlIui/ecaNguc=", + "requires": { + "connect-busboy": "0.0.2", + "fs-extra": "^0.22.1", + "streamifier": "^0.1.1" + }, + "dependencies": { + "fs-extra": { + "version": "0.22.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.22.1.tgz", + "integrity": "sha1-X9b4BJ3JdsoZ6yNV1lgXPKvM4FY=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "rimraf": "^2.2.8" + } + } + } + }, + "finalhandler": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.6.tgz", + "integrity": "sha1-AHrqM9Gk0+QgF/YkhIrVjSEvgU8=", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" + } + }, + "fresh": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz", + "integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44=" + }, + "fs-extra": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz", + "integrity": "sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0" + } + }, + "har-schema": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=" + }, + "har-validator": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", + "requires": { + "ajv": "^4.9.1", + "har-schema": "^1.0.5" + } + }, + "http-errors": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", + "requires": { + "depd": "~1.1.2", + "inherits": "2.0.3", + "setprototypeof": "1.1.0", + "statuses": ">= 1.4.0 < 2" + } + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.15.tgz", + "integrity": "sha1-/iZaIYrGpXz+hUkn6dBMGYJe3es=" + }, + "ipaddr.js": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.4.0.tgz", + "integrity": "sha1-KWrKh4qCGBbluF0KKFqZvP9FgvA=" + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=" + }, + "mime": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz", + "integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM=" + }, + "moment": { + "version": "2.18.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.18.1.tgz", + "integrity": "sha1-w2GT3Tzhwu7SrbfIAtu8d6gbHA8=" + }, + "node-pre-gyp": { + "version": "0.6.34", + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.34.tgz", + "integrity": "sha1-lK0ceYoR1/xnOBtQ1H+MwY2Xmfc=", + "requires": { + "mkdirp": "^0.5.1", + "nopt": "^4.0.1", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "request": "^2.81.0", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^2.2.1", + "tar-pack": "^3.4.0" + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "performance-now": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=" + }, + "proxy-addr": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.5.tgz", + "integrity": "sha1-ccDuOxAt4/IC87ZPYI0XP8uhqRg=", + "requires": { + "forwarded": "~0.1.0", + "ipaddr.js": "1.4.0" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "q": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.0.tgz", + "integrity": "sha1-3QG6ydBtMObyGa7LglPunr3DCPE=" + }, + "qs": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=" + }, + "raw-body": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.2.0.tgz", + "integrity": "sha1-mUl2z2pQlqQRYoQEkvC9xdbn+5Y=", + "requires": { + "bytes": "2.4.0", + "iconv-lite": "0.4.15", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.81.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~4.2.1", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "performance-now": "^0.2.0", + "qs": "~6.4.0", + "safe-buffer": "^5.0.1", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.0.0" + } + }, + "request-promise": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.0.tgz", + "integrity": "sha1-aE93dI1rRhe+5qTvRGmQbm0HRyA=", + "requires": { + "bluebird": "^3.5.0", + "request-promise-core": "1.1.1", + "stealthy-require": "^1.0.0" + } + }, + "request-promise-core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", + "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "requires": { + "lodash": "^4.13.1" + } + }, + "rimraf": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "requires": { + "glob": "^7.0.5" + } + }, + "send": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.15.1.tgz", + "integrity": "sha1-igI1TCbm9cynAAZfXwzeupDse18=", + "requires": { + "debug": "2.6.1", + "depd": "~1.1.0", + "destroy": "~1.0.4", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.0", + "fresh": "0.5.0", + "http-errors": "~1.6.1", + "mime": "1.3.4", + "ms": "0.7.2", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.3.1" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "serve-static": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.1.tgz", + "integrity": "sha1-dEOpZePO1kes61Y5+ga/TRu+ADk=", + "requires": { + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "parseurl": "~1.3.1", + "send": "0.15.1" + } + }, + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "requires": { + "through": "2" + } + }, + "stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "requires": { + "duplexer": "~0.1.1" + } + }, + "tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + }, + "tmp": { + "version": "0.0.31", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.31.tgz", + "integrity": "sha1-jzirlDjhcxXl29izZX6L+yd65Kc=", + "requires": { + "os-tmpdir": "~1.0.1" + } + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "^1.4.1" + } + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "utils-merge": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz", + "integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg=" + } + } + }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", @@ -1896,8 +2449,7 @@ "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, "external-editor": { "version": "3.1.0", @@ -2173,6 +2725,27 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "fstream": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", + "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, + "fstream-ignore": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", + "integrity": "sha1-nDHa40dnAY/h0kmyTa2mfQktoQU=", + "requires": { + "fstream": "^1.0.0", + "inherits": "2", + "minimatch": "^3.0.0" + } + }, "functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", @@ -2303,6 +2876,11 @@ "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", "dev": true }, + "hammerjs": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", + "integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE=" + }, "handlebars": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.4.tgz", @@ -2427,11 +3005,27 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=" }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + } + }, "highlight.js": { "version": "9.18.1", "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.1.tgz", "integrity": "sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg==" }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=" + }, "http-errors": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", @@ -2755,6 +3349,11 @@ "nomnom": "1.5.2" } }, + "jquery": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz", + "integrity": "sha1-LInWiJterFIqfuoywUUhVZxsvwI=" + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -2804,6 +3403,14 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, + "json-stable-stringify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "requires": { + "jsonify": "~0.0.0" + } + }, "json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -2829,6 +3436,11 @@ "graceful-fs": "^4.1.6" } }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" + }, "jsonlint": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.0.tgz", @@ -3376,6 +3988,16 @@ "resolved": "https://registry.npmjs.org/marked/-/marked-0.8.0.tgz", "integrity": "sha512-MyUe+T/Pw4TZufHkzAfDj6HarCBWia2y27/bhuYkTaiUnfDYFnCP3KUN+9oM7Wi6JA2rymtVYbQu3spE0GCmxQ==" }, + "materialize-css": { + "version": "0.98.1", + "resolved": "https://registry.npmjs.org/materialize-css/-/materialize-css-0.98.1.tgz", + "integrity": "sha1-cnaJWyyZi1PibeqgwjoEhMCFHZk=", + "requires": { + "hammerjs": "^2.0.4", + "jquery": "^2.1.4", + "node-archiver": "^0.3.0" + } + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -3872,8 +4494,7 @@ "ms": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", - "dev": true + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=" }, "multimeter": { "version": "0.1.1", @@ -4146,6 +4767,27 @@ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, + "node-archiver": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/node-archiver/-/node-archiver-0.3.0.tgz", + "integrity": "sha1-ufGv5QBtC98pJgGBgzoHCXi8aUc=", + "requires": { + "fstream": "^1.0.10", + "tar": "^2.2.1" + }, + "dependencies": { + "tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + } + } + }, "node-gyp-build": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.1.1.tgz", @@ -6068,6 +6710,14 @@ "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.1.0.tgz", "integrity": "sha512-iVICrxOzCynf/SNaBQCw34eM9jROU/s5rzIhpOvzhzuYHfJR/DhZfDkXiZSgKXfgv26HT3Yni3AV/DGw0cGnnw==" }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "requires": { + "hoek": "2.x.x" + } + }, "socks": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/socks/-/socks-2.3.3.tgz", @@ -6238,6 +6888,11 @@ "through": "~2.3.4" } }, + "streamifier": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/streamifier/-/streamifier-0.1.1.tgz", + "integrity": "sha1-l+mNj6TRBdYqJpHR3AfoINuN/E8=" + }, "streamsearch": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-0.1.2.tgz", @@ -6293,6 +6948,11 @@ "is-regexp": "^1.0.0" } }, + "stringstream": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==" + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", @@ -6476,6 +7136,33 @@ } } }, + "tar-pack": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.4.1.tgz", + "integrity": "sha512-PPRybI9+jM5tjtCbN2cxmmRU7YmqT3Zv/UDy48tAh2XRkLa9bAORtSWLkVc13+GJF+cdTh1yEnHEk3cpTaL5Kg==", + "requires": { + "debug": "^2.2.0", + "fstream": "^1.0.10", + "fstream-ignore": "^1.0.5", + "once": "^1.3.3", + "readable-stream": "^2.1.4", + "rimraf": "^2.5.1", + "tar": "^2.2.1", + "uid-number": "^0.0.6" + }, + "dependencies": { + "tar": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz", + "integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==", + "requires": { + "block-stream": "*", + "fstream": "^1.0.12", + "inherits": "2" + } + } + } + }, "tar-stream": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.1.2.tgz", @@ -6728,6 +7415,11 @@ "resolved": "https://registry.npmjs.org/typical/-/typical-2.6.1.tgz", "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=" }, + "uid-number": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", + "integrity": "sha1-DqEOgDXo61uOREnwbaHHMGY7qoE=" + }, "ultron": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.0.2.tgz", diff --git a/package.json b/package.json index 558b4ee70..29ebe2b06 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "test": "DUNITER_JS_TESTS=yes DUNITER_LOG_STDOUT=no nyc --reporter html mocha", "start": "cargo run -- start", "build": "./neon/build.sh && cd.. && tsc && cd \"../node_modules/duniter-ui\" && npm install && npm run build", - "install": "./neon/build.sh", + "install": "cd neon && neon build --release", "lint": "lint-staged", "prettier": "prettier --write app/**/*/*.ts", "format:check": "prettier --list-different 'app/**/*.{ts,json}'", diff --git a/rust-bins/duniter-cli/src/daemon.rs b/rust-bins/duniter-cli/src/daemon.rs index 6e3c524f8..003a5dbfa 100644 --- a/rust-bins/duniter-cli/src/daemon.rs +++ b/rust-bins/duniter-cli/src/daemon.rs @@ -13,103 +13,103 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. -use crate::*; - -pub fn start(prod: bool, profile_path: &Path, duniter_js_args: &[String]) -> Result<()> { - let mut duniter_js_command = Command::new(get_node_path()?); - if prod { - duniter_js_command.current_dir(DUNITER_JS_CURRENT_DIR); - } - let mut child = duniter_js_command - .args(duniter_js_args) - .stdout(Stdio::null()) - .stderr(Stdio::null()) - .env("DUNITER_MODE", "start") - .spawn()?; - - let pid = child.id(); - - // Write pid on file - { - let mut pid_file = File::create(profile_path.join("app.pid"))?; - pid_file.write_all(format!("{}\n{}", pid, duniter_js_args.join(" ")).as_bytes())?; - } - - println!("Duniter daemon launched (pid: {}).", pid); - - let daemon = Daemon::new().umask(0o000).start(); - - if let Err(e) = daemon { - eprintln!("Error, {}", e); - } - - let status = child.wait().expect("fail to wait child"); - - std::process::exit(status.code().unwrap_or_default()) -} - -pub fn status(profile_path: &Path) -> Result<()> { - let mut pid_file = File::open(profile_path.join("app.pid"))?; - let mut pid_file_content = String::new(); - pid_file.read_to_string(&mut pid_file_content)?; - let mut lines = pid_file_content.split('\n'); - let pid = lines - .next() - .expect("corrupted pid file") - .parse::<i32>() - .expect("invalid pid"); - - match nix::sys::signal::kill(Pid::from_raw(pid), Some(Signal::SIGUSR1)) { - Ok(()) => { - println!("Duniter is running using PID {}.", pid); - Ok(()) - } - Err(Error::Sys(Errno::ESRCH)) => { - println!("Duniter is not running."); - std::process::exit(EXIT_CODE_DUNITER_NOT_RUNNING); - } - Err(e) => Err(e.into()), - } -} - -pub fn stop(profile_path: &Path) -> Result<Vec<String>> { - let mut pid_file = File::open(profile_path.join("app.pid"))?; - let mut pid_file_content = String::new(); - pid_file.read_to_string(&mut pid_file_content)?; - let mut lines = pid_file_content.split('\n'); - let pid = lines - .next() - .expect("corrupted pid file") - .parse::<i32>() - .expect("invalid pid"); - let duniter_args: Vec<String> = lines - .next() - .expect("corrupted pid file") - .split(' ') - .map(ToOwned::to_owned) - .collect(); - - match nix::sys::signal::kill(Pid::from_raw(pid), Some(Signal::SIGINT)) { - Err(Error::Sys(Errno::ESRCH)) => { - println!("Duniter is not running."); - Ok(duniter_args) - } - Err(e) => Err(e.into()), - Ok(()) => { - println!("Stopping Duniter daemon …"); - loop { - match nix::sys::signal::kill(Pid::from_raw(pid), Some(Signal::SIGUSR1)) { - Ok(()) => { - std::thread::sleep(std::time::Duration::from_secs(1)); - continue; - } - Err(Error::Sys(Errno::ESRCH)) => { - println!("Duniter daemon stopped."); - return Ok(duniter_args); - } - Err(e) => return Err(e.into()), - } - } - } - } -} +// use crate::*; +// +// pub fn start(prod: bool, profile_path: &Path, duniter_js_args: &[String]) -> Result<()> { +// let mut duniter_js_command = Command::new(get_node_path()?); +// if prod { +// duniter_js_command.current_dir(DUNITER_JS_CURRENT_DIR); +// } +// let mut child = duniter_js_command +// .args(duniter_js_args) +// .stdout(Stdio::null()) +// .stderr(Stdio::null()) +// .env("DUNITER_MODE", "start") +// .spawn()?; +// +// let pid = child.id(); +// +// // Write pid on file +// { +// let mut pid_file = File::create(profile_path.join("app.pid"))?; +// pid_file.write_all(format!("{}\n{}", pid, duniter_js_args.join(" ")).as_bytes())?; +// } +// +// println!("Duniter daemon launched (pid: {}).", pid); +// +// let daemon = Daemon::new().umask(0o000).start(); +// +// if let Err(e) = daemon { +// eprintln!("Error, {}", e); +// } +// +// let status = child.wait().expect("fail to wait child"); +// +// std::process::exit(status.code().unwrap_or_default()) +// } +// +// pub fn status(profile_path: &Path) -> Result<()> { +// let mut pid_file = File::open(profile_path.join("app.pid"))?; +// let mut pid_file_content = String::new(); +// pid_file.read_to_string(&mut pid_file_content)?; +// let mut lines = pid_file_content.split('\n'); +// let pid = lines +// .next() +// .expect("corrupted pid file") +// .parse::<i32>() +// .expect("invalid pid"); +// +// match nix::sys::signal::kill(Pid::from_raw(pid), Some(Signal::SIGUSR1)) { +// Ok(()) => { +// println!("Duniter is running using PID {}.", pid); +// Ok(()) +// } +// Err(Error::Sys(Errno::ESRCH)) => { +// println!("Duniter is not running."); +// std::process::exit(EXIT_CODE_DUNITER_NOT_RUNNING); +// } +// Err(e) => Err(e.into()), +// } +// } +// +// pub fn stop(profile_path: &Path) -> Result<Vec<String>> { +// let mut pid_file = File::open(profile_path.join("app.pid"))?; +// let mut pid_file_content = String::new(); +// pid_file.read_to_string(&mut pid_file_content)?; +// let mut lines = pid_file_content.split('\n'); +// let pid = lines +// .next() +// .expect("corrupted pid file") +// .parse::<i32>() +// .expect("invalid pid"); +// let duniter_args: Vec<String> = lines +// .next() +// .expect("corrupted pid file") +// .split(' ') +// .map(ToOwned::to_owned) +// .collect(); +// +// match nix::sys::signal::kill(Pid::from_raw(pid), Some(Signal::SIGINT)) { +// Err(Error::Sys(Errno::ESRCH)) => { +// println!("Duniter is not running."); +// Ok(duniter_args) +// } +// Err(e) => Err(e.into()), +// Ok(()) => { +// println!("Stopping Duniter daemon …"); +// loop { +// match nix::sys::signal::kill(Pid::from_raw(pid), Some(Signal::SIGUSR1)) { +// Ok(()) => { +// std::thread::sleep(std::time::Duration::from_secs(1)); +// continue; +// } +// Err(Error::Sys(Errno::ESRCH)) => { +// println!("Duniter daemon stopped."); +// return Ok(duniter_args); +// } +// Err(e) => return Err(e.into()), +// } +// } +// } +// } +// } diff --git a/rust-bins/duniter-cli/src/main.rs b/rust-bins/duniter-cli/src/main.rs index ccc106439..4a18912bc 100644 --- a/rust-bins/duniter-cli/src/main.rs +++ b/rust-bins/duniter-cli/src/main.rs @@ -31,11 +31,11 @@ mod duniter_ts_args; mod sync; use anyhow::{anyhow, Result}; -use daemonize_me::Daemon; +// use daemonize_me::Daemon; #[cfg(target_arch = "x86_64")] use duniter_gva_conf::GvaCommand; -use logwatcher::{LogWatcher, LogWatcherAction}; -use nix::{errno::Errno, sys::signal::Signal, unistd::Pid, Error}; +// use logwatcher::{LogWatcher, LogWatcherAction}; +// use nix::{errno::Errno, sys::signal::Signal, unistd::Pid, Error}; use std::{ fs::File, io::prelude::*, path::Path, path::PathBuf, process::Command, process::Output, process::Stdio, str::FromStr, @@ -232,18 +232,18 @@ fn main() -> Result<()> { duniter_ts_args::gen_duniter_ts_args(&args, duniter_js_exe()?, log_level_filter); match args.command { - DuniterCommand::Restart => { - daemon::start(prod, &profile_path, &daemon::stop(&profile_path)?) - } - DuniterCommand::Start(_) | DuniterCommand::Webstart { .. } => { - daemon::start(prod, &profile_path, &duniter_ts_args) - } - DuniterCommand::Status => daemon::status(&profile_path), - DuniterCommand::Stop => { - daemon::stop(&profile_path)?; - Ok(()) - } - DuniterCommand::Logs => watch_logs(profile_path), + // DuniterCommand::Restart => { + // daemon::start(prod, &profile_path, &daemon::stop(&profile_path)?) + // } + // DuniterCommand::Start(_) | DuniterCommand::Webstart { .. } => { + // daemon::start(prod, &profile_path, &duniter_ts_args) + // } + // DuniterCommand::Status => daemon::status(&profile_path), + // DuniterCommand::Stop => { + // daemon::stop(&profile_path)?; + // Ok(()) + // } + // DuniterCommand::Logs => watch_logs(profile_path), _ => { ctrlc::set_handler(move || { // This empty handler is necessary otherwise the Rust process is stopped immediately @@ -348,13 +348,13 @@ fn get_profile_path(profile: Option<&str>) -> Result<PathBuf> { Ok(profile_path) } -fn watch_logs(profile_path: PathBuf) -> Result<()> { - let mut log_watcher = LogWatcher::register(profile_path.join(LOG_FILE))?; - - log_watcher.watch(&mut move |line: String| { - println!("{}", line); - LogWatcherAction::None - }); - - Ok(()) -} +// fn watch_logs(profile_path: PathBuf) -> Result<()> { +// let mut log_watcher = LogWatcher::register(profile_path.join(LOG_FILE))?; +// +// log_watcher.watch(&mut move |line: String| { +// println!("{}", line); +// LogWatcherAction::None +// }); +// +// Ok(()) +// } -- GitLab