Skip to content

Commit f59b2ec

Browse files
committed
feat: replace exec with spawn for http-server and update version to 1.0.13
1 parent 211429f commit f59b2ec

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22

3-
const { exec } = require('child_process');
3+
const { spawn } = require('child_process');
44
const fs = require('fs');
55
const path = require('path');
66
const https = require('https');
@@ -114,11 +114,9 @@ async function downloadFileWithRetries(url, filePath, maxRetries = 3) {
114114
return;
115115
} catch (error) {
116116
if (attempt < maxRetries) {
117-
logger.warn(`Retry ${attempt}/${maxRetries} for ${filePath}${error.message} (${url})`);
117+
logger.warn(`Retry ${attempt}/${maxRetries} ${filePath}`);
118118
} else {
119-
logger.error(
120-
`Download failed for ${filePath} from ${url} after ${maxRetries} retries: ${error.message}`,
121-
);
119+
logger.error(`Failed after ${maxRetries} retries → ${filePath}`);
122120
}
123121
}
124122
}
@@ -143,7 +141,7 @@ userInputReader.question(
143141
logger.info(divider);
144142
console.log();
145143

146-
const httpServerProcess = exec(`npx http-server -p ${port}`);
144+
const httpServerProcess = spawn('npx', ['http-server', '-p', String(port)]);
147145

148146
httpServerProcess.stdout.on('data', async (data) => {
149147
const output = data.toString();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "resource-save-script",
3-
"version": "1.0.12",
3+
"version": "1.0.13",
44
"description": "HTTP server with auto-download capability",
55
"homepage": "https://github.com/luckfunc/resource-save-script#readme",
66
"bugs": {

0 commit comments

Comments
 (0)