Compare commits

..

No commits in common. "28cbb3d733809099c9fd4067da5af8d4b2c9822f" and "f4c24c3993075c4dff41c292774156a69695d2db" have entirely different histories.

8 changed files with 340 additions and 462 deletions

View File

@ -1,6 +0,0 @@
[target.riscv64gc-unknown-linux-gnu]
runner = "riscv64-unknown-elf-gdb -q -x gdb_init"
linker = "riscv64-linux-gnu-gcc"
[build]
target = "x86_64-unknown-linux-gnu"

281
Cargo.lock generated
View File

@ -43,9 +43,9 @@ dependencies = [
[[package]]
name = "anstream"
version = "0.6.15"
version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
dependencies = [
"anstyle",
"anstyle-parse",
@ -58,36 +58,36 @@ dependencies = [
[[package]]
name = "anstyle"
version = "1.0.8"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
[[package]]
name = "anstyle-parse"
version = "0.2.5"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.1.1"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
dependencies = [
"windows-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "anstyle-wincon"
version = "3.0.4"
version = "3.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
dependencies = [
"anstyle",
"windows-sys",
"windows-sys 0.52.0",
]
[[package]]
@ -131,18 +131,15 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "bytes"
version = "1.7.1"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]]
name = "cc"
version = "1.1.13"
version = "1.0.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48"
dependencies = [
"shlex",
]
checksum = "74b6a57f98764a267ff415d50a25e6e166f3831a5071af4995296ea97d210490"
[[package]]
name = "cfg-if"
@ -161,14 +158,14 @@ dependencies = [
"js-sys",
"num-traits",
"wasm-bindgen",
"windows-targets",
"windows-targets 0.52.5",
]
[[package]]
name = "colorchoice"
version = "1.0.2"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
[[package]]
name = "combine"
@ -182,15 +179,15 @@ dependencies = [
[[package]]
name = "core-foundation-sys"
version = "0.8.7"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
[[package]]
name = "env_filter"
version = "0.1.2"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab"
checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea"
dependencies = [
"log",
"regex",
@ -198,9 +195,9 @@ dependencies = [
[[package]]
name = "env_logger"
version = "0.11.5"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d"
checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9"
dependencies = [
"anstream",
"anstyle",
@ -299,9 +296,9 @@ dependencies = [
[[package]]
name = "is_terminal_polyfill"
version = "1.70.1"
version = "1.70.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
[[package]]
name = "itoa"
@ -311,18 +308,18 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "js-sys"
version = "0.3.70"
version = "0.3.69"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "libc"
version = "0.2.158"
version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "lock_api"
@ -357,14 +354,13 @@ dependencies = [
[[package]]
name = "mio"
version = "1.0.2"
version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
dependencies = [
"hermit-abi",
"libc",
"wasi",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
@ -377,10 +373,20 @@ dependencies = [
]
[[package]]
name = "object"
version = "0.36.3"
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "object"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce"
dependencies = [
"memchr",
]
@ -411,7 +417,7 @@ dependencies = [
"libc",
"redox_syscall",
"smallvec",
"windows-targets",
"windows-targets 0.52.5",
]
[[package]]
@ -461,18 +467,18 @@ dependencies = [
[[package]]
name = "redox_syscall"
version = "0.5.3"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd"
dependencies = [
"bitflags 2.6.0",
]
[[package]]
name = "regex"
version = "1.10.6"
version = "1.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
dependencies = [
"aho-corasick",
"memchr",
@ -499,7 +505,7 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "runner-rs"
version = "0.5.0"
version = "0.4.9"
dependencies = [
"chrono",
"env_logger",
@ -531,18 +537,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "serde"
version = "1.0.208"
version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2"
checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.208"
version = "1.0.203"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf"
checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [
"proc-macro2",
"quote",
@ -551,27 +557,20 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.125"
version = "1.0.118"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed"
checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4"
dependencies = [
"itoa",
"memchr",
"ryu",
"serde",
]
[[package]]
name = "sha1_smol"
version = "1.0.1"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbfa15b3dddfee50a0fff136974b3e1bde555604ba463834a7eb7deb6417705d"
[[package]]
name = "shlex"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012"
[[package]]
name = "signal-hook-registry"
@ -595,14 +594,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [
"libc",
"windows-sys",
"windows-sys 0.52.0",
]
[[package]]
name = "syn"
version = "2.0.75"
version = "2.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9"
checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9"
dependencies = [
"proc-macro2",
"quote",
@ -626,27 +625,28 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.39.3"
version = "1.38.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5"
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
dependencies = [
"backtrace",
"bytes",
"libc",
"mio",
"num_cpus",
"parking_lot",
"pin-project-lite",
"signal-hook-registry",
"socket2",
"tokio-macros",
"windows-sys",
"windows-sys 0.48.0",
]
[[package]]
name = "tokio-macros"
version = "2.4.0"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
dependencies = [
"proc-macro2",
"quote",
@ -699,20 +699,19 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "wasm-bindgen"
version = "0.2.93"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8"
dependencies = [
"cfg-if",
"once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.93"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da"
dependencies = [
"bumpalo",
"log",
@ -725,9 +724,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.93"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@ -735,9 +734,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.93"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [
"proc-macro2",
"quote",
@ -748,9 +747,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.93"
version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
[[package]]
name = "windows-core"
@ -758,7 +757,16 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets",
"windows-targets 0.52.5",
]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]]
@ -767,69 +775,126 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets",
"windows-targets 0.52.5",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_aarch64_gnullvm 0.48.5",
"windows_aarch64_msvc 0.48.5",
"windows_i686_gnu 0.48.5",
"windows_i686_msvc 0.48.5",
"windows_x86_64_gnu 0.48.5",
"windows_x86_64_gnullvm 0.48.5",
"windows_x86_64_msvc 0.48.5",
]
[[package]]
name = "windows-targets"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
dependencies = [
"windows_aarch64_gnullvm 0.52.5",
"windows_aarch64_msvc 0.52.5",
"windows_i686_gnu 0.52.5",
"windows_i686_gnullvm",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
"windows_i686_msvc 0.52.5",
"windows_x86_64_gnu 0.52.5",
"windows_x86_64_gnullvm 0.52.5",
"windows_x86_64_msvc 0.52.5",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"

View File

@ -1,6 +1,6 @@
[package]
name = "runner-rs"
version = "0.5.0"
version = "0.4.9"
edition = "2021"
[dependencies]

View File

@ -1,60 +0,0 @@
# runner-rs (amd64/linux)
![Logo](https://blog.desdelinux.net/wp-content/uploads/2023/07/rust-logo.png)
in-container integrating util to handle processes runtime
## Depends on
- `rustup (>=1.27.1)`
## Building
1. Clone this repo `runner-rs`
~~~bash
git clone https://link-to-project
~~~
2. Enter project's dir and set up toolchain list to compile code for RISC-V and AMD64
> [!NOTE]
> Cargo is configured to build an app for amd64/linux defaultly. RISC-based compilation is optional.
~~~bash
cd runner-rs/
rustup target add riscv64gc-unknown-linux-gnu
rustup target add x86_64-unknown-linux-gnu
~~~
3.1. Release build of app for amd64/linux
~~~bash
cargo build --release
~~~
3.2. Release build of app for riscv64/linux
~~~bash
cargo build --release --target riscv64gc-unknown-linux-gnu
~~~
## Execution for amd64/linux
~~~bash
./target/x86_64-unknown-linux-gnu/release/runner-rs
~~~
or
~~~bash
cargo run --release
~~~
## Execution for riscv64/linux
~~~bash
./target/riscv64gc-unknown-linux-gnu/release/runner-rs
~~~
or
~~~bash
cargo run --release
~~~

View File

@ -1,9 +0,0 @@
set history save on
set confirm off
set remotetimeout 240
target extended-remote :3333
set print asm-demangle on
monitor reset halt
load
continue
# quit

View File

@ -1 +0,0 @@
stable

View File

@ -16,7 +16,7 @@
}
},
{
"filename": "config-file.json",
"filename": "config-file",
"src": "/home/vladislav/web/",
"triggers": {
"onDelete": "stop",
@ -53,8 +53,8 @@
],
"services": [
{
"hostname": "localhost",
"port": 6379,
"hostname": "google.com",
"port": 443,
"triggers": {
"wait": 14,
"delay": 1,

View File

@ -1,29 +1,27 @@
use redis::{Client, Commands, Connection};
use redis::Commands;
// json parsing
use serde::{ Deserialize, Serialize };
use serde_json;
// async multi-threaded execution
use tokio::time::{ Duration, Instant };
use tokio::time::{ error, Duration, Instant };
use tokio::sync::mpsc;
use tokio::join;
// use tokio::io::{AsyncRead, AsyncWrite};
// fatal errors handler
use core::panic;
use std::borrow::BorrowMut;
use core::{panic, time};
// utils
use std::fmt::Debug;
use std::fs;
use std::os::unix::process;
use std::path::Path;
use std::process::{ Command, Output };
use std::sync::Arc;
// file change handler
use inotify::{ EventMask, Inotify, WatchMask };
use inotify::{ Inotify, WatchMask };
// logging
use std::io::Write;
use chrono::Local;
use chrono::{Local, Utc};
use env_logger::Builder;
use log::{error, info, warn, LevelFilter};
use std::net::{TcpStream, ToSocketAddrs};
use log::{error, warn, LevelFilter};
static CONFIG_PATH : &'static str = "settings.json";
@ -31,10 +29,6 @@ static CONFIG_PATH : &'static str = "settings.json";
enum CustomError {
Fatal,
}
enum ConfigActuality {
Local,
Remote,
}
/// # struct for the 1st level in json conf file
/// > (needed in serialization and deserialization)
@ -123,10 +117,124 @@ async fn main() {
// setting up redis connection \
// then conf checks to choose the most actual \
let processes: Processes = get_actual_config().unwrap_or_else(|| {
error!("No actual configuration for runner");
std::process::exit(101);
});
let client = redis::Client::open("redis://127.0.0.1").expect("error connecting redis server");
let mut conn = client.get_connection().expect("error getting connection");
log::info!("Waitng for a config file from DB ...");
if let Ok(len) = conn.xlen::<&str, usize>("config_stream") {
if len <= 0 {
warn!("No configuration in DB yet. Waiting ...");
while conn.xlen::<&str, usize>("config_stream").unwrap() <= 0 {
std::thread::sleep(Duration::from_millis(400));
}
}
} else {
error!("Cannot find needed stream to get configuration");
return;
}
let conf: redis::RedisResult<Vec<Vec<(String, Vec<(String, String)>)>>> = conn.xrevrange_count("config_stream", "+", "-", 1);
let mut config: Vec<(String, Vec<(String, String)>)> = Vec::new();
if conf.is_ok() {
// guarranted safe unwrapping
config = conf.unwrap()[0].clone();
// let idx = config[0].0.find('-').unwrap();
// let true_milis: i64 = config[0].0
// .chars()
// .enumerate()
// .filter(|(id, _)| *id < idx)
// .map(|(_, chr)| chr)
// .collect::<String>()
// .parse()
// .unwrap();
// let date = chrono::DateTime::from_timestamp_millis(true_milis).unwrap();
// log::info!("Log from {} was given", date);
} else {
// rewrite error handler
println!("error: {}", conf.unwrap_err());
}
let processes: Processes;
if config.is_empty() {
error!("No suitable configs were given!");
log::info!("Trying to get local config...");
// matching check
match load_processes(CONFIG_PATH) {
Some(prcs) => processes = prcs,
None => {
error!("No config for runner. Cannot continue running...");
return;
},
}
} else {
// matching check
match parse_extern_config(&config[0].1[0].1) {
Some(prcs) => {
//
// comparing and optionally rewriting config file
//
if let Some(local) = load_processes(CONFIG_PATH) {
// comparing
let local_date: u64 = local.date_of_creation.parse().unwrap();
let external_date: u64 = prcs.date_of_creation.parse().unwrap();
match local_date.cmp(&external_date) {
std::cmp::Ordering::Less => {
// server has sent newest version
warn!("Updating config (new version - {})...", &native_date_from_milis(&prcs.date_of_creation).unwrap());
processes = prcs;
let _ = save_new_config(&processes, CONFIG_PATH);
},
std::cmp::Ordering::Equal => {
// server has sent equal version
processes = prcs;
log::info!("Local version is actual");
},
std::cmp::Ordering::Greater => {
// server has sent an elder version
log::warn!("Local config version is more actual");
processes = local;
},
}
} else {
// settings.json can be deleted
processes = prcs;
match std::fs::File::create(CONFIG_PATH) {
Ok(_) => {
// saving server conf (truncating or adding new)
let _ = save_new_config(&processes, CONFIG_PATH);
},
Err(_) => {
error!("Cannot create or truncate local config file");
},
}
}
},
None => {
//temp
warn!("External config file parsing failed. Trying to get local config...");
if let Some(prcs) = load_processes(CONFIG_PATH) {
processes = prcs;
let date_of_creation: Result<i64, _> = processes.date_of_creation.parse();
if date_of_creation.is_err() {
error!("Local config date of creation parsing failed. Returning...");
return;
} else {
let date_of_creation = date_of_creation.unwrap();
if let Some(date) = chrono::DateTime::from_timestamp_millis(date_of_creation) {
log::info!("Config from {} is actual now!", date);
} else {
error!("Local config date of creation parsing failed. Returning...");
return;
}
}
} else {
error!("No config for runner. Cannot continue running...");
return;
}
},
}
}
log::info!("Current runner configuration: {}\n", &processes.date_of_creation);
@ -161,173 +269,12 @@ async fn main() {
return;
}
fn get_actual_config() -> Option<Processes> {
// todo: local check Some|None -> redis check
// * if no conf -> loop and +inf getting conf from redis server
// let mut local = load_processes(&CONFIG_PATH);
match load_processes(&CONFIG_PATH) {
Some(local_conf) => {
if let Some(remote_conf) = once_get_remote_configuration("redis://localhost") {
match config_comparing(&local_conf, &remote_conf) {
ConfigActuality::Local => {
info!("Local config is actual");
return Some(local_conf);
},
ConfigActuality::Remote => {
info!("Pulled config is more actual. Saving changes!");
if save_new_config(&remote_conf, &CONFIG_PATH).is_err() {
error!("Saving changes process failed due to unexpected error...")
}
return Some(remote_conf);
},
}
}
return Some(local_conf);
},
None => {
// ? ? OUTSTANDING CONSTRUCTION ?
let mut conn = get_connection_watcher(&open_watcher("redis://localhost"));
get_stream_info_watcher(&mut conn);
let remote_config = invalid_config_watcher(&mut conn);
let _ = save_new_config(&remote_config, &CONFIG_PATH);
Some(remote_config)
},
fn native_date_from_milis(mls: &str) -> Option<chrono::DateTime<Utc>> {
match mls.parse::<i64>(){
Ok(val) => return chrono::DateTime::from_timestamp_millis(val),
Err(_) => return None,
}
}
// ! once iter exec
// ! only for situation when local isnt None (no need to fck redis server)
fn once_get_remote_configuration(serv_info: &str) -> Option<Processes> {
match redis::Client::open(serv_info) {
Ok(client) => {
match client.get_connection() {
Ok(mut conn) => {
if let Ok(len) = conn.xlen::<&str, usize>("config_stream") {
if len == 0 {
warn!("No configuration in DB yet");
return None;
} else {
let conf: redis::RedisResult<Vec<Vec<(String, Vec<(String, String)>)>>> = conn.xrevrange_count("config_stream", "+", "-", 1);
let config: &Vec<(String, Vec<(String, String)>)>;
if conf.is_ok() {
// guarranted safe unwrapping
let conf = conf.unwrap();
config = &conf[0];
if config.is_empty() {
error!("Empty config was pulled. Check stream and configs state!");
return None;
}
match parse_extern_config(&config[0].1[0].1) {
Some(prcs) => return Some(prcs),
None => {
error!("Invalid configuration was pulled (PARSING_ERROR). Check configs state!");
return None;
},
}
} else {
error!("Configuration pulling from Redis stream failed. Check stream state!");
return None;
}
}
} else {
error!("Cannot find config_stream. Check Redis-stream accessibility!");
return None;
}
},
Err(_) => {
error!("Redis connection attempt is failed. Check Redis configuration!");
return None;
},
}
},
Err(_) => {
error!("Redis-Client opening attempt is failed. Check network configuration!");
return None;
},
}
}
// ! watchers
fn open_watcher(serv_info: &str) -> redis::Client {
loop {
match redis::Client::open(serv_info) {
Ok(redis) => {
info!("Succesfully opened Redis-Client");
return redis
},
Err(_) => {
error!("Redis-Client opening attempt is failed. Check network configuration! Retrying...");
std::thread::sleep(Duration::from_secs(4));
}
}
}
}
fn get_connection_watcher(client: &Client) -> Connection {
loop {
match client.get_connection() {
Ok(conn) => {
info!("Succesfully got Redis connection object");
return conn;
},
Err(_) => {
error!("Redis connection attempt is failed. Check Redis configuration! Retrying...");
std::thread::sleep(Duration::from_secs(4));
}
}
}
}
fn get_stream_info_watcher(conn: &mut Connection) {
loop {
if let Ok(val) = conn.xlen::<&str, usize>("config_stream") {
if val != 0 {
info!("Redis stream is able and not empty now");
return;
}
}
error!("Configuration pulling from Redis stream failed. Check stream state! Retrying...");
std::thread::sleep(Duration::from_secs(4));
}
}
fn invalid_config_watcher(conn: &mut Connection) -> Processes {
// let res: redis::RedisResult<Vec<Vec<(String, Vec<(String, String)>)>>>;
loop {
let res: redis::RedisResult<Vec<Vec<(String, Vec<(String, String)>)>>> = conn.xrevrange_count("config_stream", "+", "-", 1);
if res.is_ok() {
let config = &res.unwrap()[0];
if !config.is_empty() {
if let Some(conf) = parse_extern_config(&config[0].1[0].1) {
return conf;
}
}
}
error!("Got INVALID configuration. Update config! Retrying...");
std::thread::sleep(Duration::from_secs(4));
}
}
// ! end of watchers
fn config_comparing(local: &Processes, remote: &Processes) -> ConfigActuality {
let local_date: u64 = local.date_of_creation.parse().unwrap();
let remote_date: u64 = remote.date_of_creation.parse().unwrap();
match local_date.cmp(&remote_date) {
std::cmp::Ordering::Equal |
std::cmp::Ordering::Greater => return ConfigActuality::Local,
std::cmp::Ordering::Less => return ConfigActuality::Remote,
}
}
// ! TEMPORARLY DEPRICATED !
// fn native_date_from_milis(mls: &str) -> Option<chrono::DateTime<Utc>> {
// match mls.parse::<i64>(){
// Ok(val) => return chrono::DateTime::from_timestamp_millis(val),
// Err(_) => return None,
// }
// }
fn save_new_config(config: &Processes, config_file: &str) -> Result<(), CustomError> {
match serde_json::to_string_pretty(&config) {
@ -343,33 +290,14 @@ fn save_new_config(config: &Processes, config_file: &str) -> Result<(), CustomEr
async fn create_watcher(filename: &str, path: &str) -> Result<Inotify, std::io::Error> {
let src = format!("{}{}", path, filename);
let mut inotify = Inotify::init().unwrap_or_else(|_| {
error!("{}",format!("Cannot create watcher for {}", &src));
std::process::exit(101);
});
let mut inotify: Inotify = Inotify::init().expect(&("Error: Cannot create watcher for ".to_owned() + &src));
_ = inotify
.watches()
.add(
&src,
WatchMask::ALL_EVENTS
WatchMask::MODIFY
);
// !
// // let _ = stream
// // .watches()
// // .add(
// // &src,
// // WatchMask::ALL_EVENTS
// // );
// while let Some(a) = stream.next().await {
// // println!("event - {:?}", a);
// if a.unwrap().mask == EventMask::MODIFY {
// counter+=1;
// println!("mod {} - {:?}", counter, stream);
// }
// }
// todo!();
// !
Ok(inotify)
}
@ -486,6 +414,7 @@ async fn run_daemons(
// 4ever sync
fn load_processes(json_filename: &str) -> Option<Processes>{
// let read = fs::read_to_string(json_filename);//.expect(format!("Missing '{}' file. Cannot start runner", json_filename).as_str());
match fs::read_to_string(json_filename) {
Ok(res) => {
match serde_json::from_str::<Processes>(&res) {
@ -517,26 +446,18 @@ async fn get_pid(name: &str) -> Output {
Command::new("pidof")
.arg(&*name)
.output()
.unwrap_or_else(|_| {
error!("Failed to execute command 'pidof'");
std::process::exit(101);
})
.expect("Failed to execute command 'pidof'")
})
.await
.unwrap()
}
// ! can be with bug !!!
// * APPROVED
async fn is_active(name: &str)-> bool {
let arc_name = Arc::new(name.to_string());
tokio::task::spawn_blocking(move || {
let output = Command::new("pidof")
.arg(&*arc_name)
.output()
.unwrap_or_else(|_| {
error!("Failed to execute command 'pidof'");
std::process::exit(101);
});
.expect("Failed to execute command 'pidof'");
!String::from_utf8_lossy(&output.stdout).trim().is_empty()
})
.await
@ -554,10 +475,7 @@ async fn is_frozen(name: &str) -> bool {
let cmd = Command::new("ps")
.args(["-o", "stat=", "-p", &arc_pid])
.output()
.unwrap_or_else(|_| {
error!("Failed to execute ps command");
std::process::exit(101);
});
.expect("Failed to execute ps command");
!(String::from_utf8_lossy(&cmd.stdout) == "Sl+\n")
})
.await
@ -568,29 +486,19 @@ async fn terminate_process (name: &str) {
let _ = Command::new("pkill")
.arg(name)
.output()
.unwrap_or_else(|_| {
error!("Failed to execute command 'pkill'");
std::process::exit(101);
});
.expect("Failed to execute command 'pkill'");
}
// another test
async fn freeze_process(name: &str) {
let _ = Command::new("pkill")
.args(["-STOP", name])
.output()
.unwrap_or_else(|_| {
error!("Failed to freeze process");
std::process::exit(101);
});
.expect("Failed to freeze process");
}
async fn unfreeze_process(name: &str) {
let _ = Command::new("pkill")
.args(["-CONT", name])
.output()
.unwrap_or_else(|_| {
error!("Failed to unfreeze process");
std::process::exit(101);
});
.expect("Failed to unfreeze process");
}
async fn restart_process(name: &str, path: &str) -> Result<(), CustomError> {
terminate_process(name).await;
@ -682,29 +590,11 @@ async fn file_handler
}
} else if is_active(name).await && !is_frozen(name).await{
let watchers = watchers.clone();
// println!("mutex: {:?}", watchers);
let mut buffer = [0; 128];
let mut mutex_guard = watchers.lock().await;
if let Some(notify) = mutex_guard.get_mut(i) {
let events = notify.read_events(&mut buffer);
// println!("{:?}", events);
if events.is_ok(){
let events: Vec<EventMask> = events.unwrap()
.into_iter()
.map(|mask| {mask.mask})
.filter(|mask| {
*mask == EventMask::MODIFY || *mask == EventMask::DELETE_SELF
})
.collect();
for event in events {
if let EventMask::DELETE_SELF = event {
// ! warning (DELETE_SELF event) !
// println!("! warning (DELETE_SELF event) !");
// * watcher recreation after dealing with file recreation mech in text editors
let mutex = notify.borrow_mut();
*mutex = create_watcher(&file.filename, &file.src).await.unwrap();
}
if events.is_ok() {
match file.triggers.on_change.as_str() {
"stop" => {
let _ = tx.send(7).await;
@ -723,7 +613,6 @@ async fn file_handler
}
}
}
}
tokio::task::yield_now().await;
Ok(())
}
@ -824,20 +713,20 @@ async fn looped_service_connecting(
return Err(CustomError::Fatal);
}
}
async fn check_service(host: &str, port: &u32) -> Result<(), CustomError> {
let mut command = Command::new("bash");
command.args(["service-checker.sh", host, &port.to_string()]);
// ! have to be rewritten
// todo: rewrite use
async fn check_service(hostname: &str, port: &u32) -> Result<(), CustomError> {
let addr = format!("{}:{}", hostname, port);
match addr.to_socket_addrs() {
Ok(mut addrs) => {
if let Some(_) = addrs.find(|a| TcpStream::connect_timeout(a, std::time::Duration::new(1, 0)).is_ok()) {
match command.output() {
Ok(output) => {
if output.status.success() {
return Ok(());
} else {
return Err(CustomError::Fatal);
}
},
Err(_) => return Err(CustomError::Fatal),
}
Err(_) => {
return Err(CustomError::Fatal);
},
};
}