@yetech/estra7ah 3.1.2 → 3.1.4
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.
- package/dist/estra7ah.js +33 -18
- package/package.json +1 -1
package/dist/estra7ah.js
CHANGED
|
@@ -47,12 +47,22 @@ async function start() {
|
|
|
47
47
|
stdio: "inherit",
|
|
48
48
|
shell: true,
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
setTimeout(() => {
|
|
51
|
+
// if it's linux,macos, add chmod +x
|
|
52
|
+
if (process.platform !== "win32") {
|
|
53
|
+
try {
|
|
54
|
+
fs.chmodSync(dir_name + "/" + getRunner(), "755");
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.log("Error setting permissions", err);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Run the runner executable with arguments
|
|
60
|
+
const runnerProcess = child_process.spawn(runnerPath, args, options);
|
|
61
|
+
// Handle the exit event
|
|
62
|
+
runnerProcess.on("exit", (code) => {
|
|
63
|
+
console.log(`Runner exited with code ${code}`);
|
|
64
|
+
});
|
|
65
|
+
}, 1000);
|
|
56
66
|
}
|
|
57
67
|
start();
|
|
58
68
|
async function downloadRunner() {
|
|
@@ -76,11 +86,11 @@ async function downloadRunner() {
|
|
|
76
86
|
|
|
77
87
|
if (localVersion !== version) {
|
|
78
88
|
console.log("** DOWNLOADING NEW RUNNER VERSION **");
|
|
79
|
-
let
|
|
89
|
+
let serverFile = `${yetech}/runner/${getRunner()}`;
|
|
80
90
|
try {
|
|
81
91
|
const response = await axios({
|
|
82
92
|
method: "get",
|
|
83
|
-
url:
|
|
93
|
+
url: serverFile,
|
|
84
94
|
responseType: "stream",
|
|
85
95
|
});
|
|
86
96
|
|
|
@@ -93,19 +103,24 @@ async function downloadRunner() {
|
|
|
93
103
|
});
|
|
94
104
|
|
|
95
105
|
const writer = fs.createWriteStream(dir_name + "/" + getRunner());
|
|
96
|
-
response.data.on("data", (chunk) => {
|
|
97
|
-
progressBar.tick(chunk.length);
|
|
98
|
-
});
|
|
99
106
|
|
|
100
|
-
|
|
107
|
+
return new Promise((resolve, reject) => {
|
|
108
|
+
response.data.on("data", (chunk) => {
|
|
109
|
+
progressBar.tick(chunk.length);
|
|
110
|
+
});
|
|
101
111
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
112
|
+
writer.on("error", (error) => {
|
|
113
|
+
reject(error);
|
|
114
|
+
});
|
|
106
115
|
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
writer.on("finish", () => {
|
|
117
|
+
fs.writeFileSync(dir_name + "/__runnerversion", version);
|
|
118
|
+
console.log("** Finished DOWNLOADING NEW RUNNER VERSION **");
|
|
119
|
+
resolve();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
response.data.pipe(writer);
|
|
123
|
+
});
|
|
109
124
|
} catch (err) {
|
|
110
125
|
console.log("Error Downloading Runner", err);
|
|
111
126
|
}
|