@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.
Files changed (2) hide show
  1. package/dist/estra7ah.js +33 -18
  2. 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
- // Run the runner executable with arguments
51
- const runnerProcess = child_process.spawn(runnerPath, args, options);
52
- // Handle the exit event
53
- runnerProcess.on("exit", (code) => {
54
- console.log(`Runner exited with code ${code}`);
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 serverFIle = `${yetech}/runner/${getRunner()}`;
89
+ let serverFile = `${yetech}/runner/${getRunner()}`;
80
90
  try {
81
91
  const response = await axios({
82
92
  method: "get",
83
- url: serverFIle,
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
- response.data.pipe(writer);
107
+ return new Promise((resolve, reject) => {
108
+ response.data.on("data", (chunk) => {
109
+ progressBar.tick(chunk.length);
110
+ });
101
111
 
102
- await new Promise((resolve, reject) => {
103
- writer.on("finish", resolve);
104
- writer.on("error", reject);
105
- });
112
+ writer.on("error", (error) => {
113
+ reject(error);
114
+ });
106
115
 
107
- fs.writeFileSync(dir_name + "/__runnerversion", version);
108
- console.log("** Finished DOWNLOADING NEW RUNNER VERSION **");
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yetech/estra7ah",
3
- "version": "3.1.2",
3
+ "version": "3.1.4",
4
4
  "description": "Estra7ah Manager",
5
5
  "author": "Abdullah Al-taheri",
6
6
  "keywords": [