Skip to content

Commit e9e928c

Browse files
Update restart-webdav.js
Hi, my name is Pedro Manuel, I have modified the file with the aim of clearer error handling and output messages.
1 parent 68f4ba4 commit e9e928c

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

scripts/restart-webdav.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
const { exec } = require('child_process');
22

33
async function runCommand() {
4-
await new Promise((resolve, reject) => {
5-
exec('node ./bin/run.js webdav restart', (error, stdout, stderr) => {
6-
if (error) {
7-
reject(error);
8-
}
9-
resolve(stdout || stderr);
4+
try {
5+
const output = await new Promise((resolve, reject) => {
6+
exec('node ./bin/run.js webdav restart', (error, stdout, stderr) => {
7+
if (error) {
8+
reject(error);
9+
return;
10+
}
11+
resolve(stdout || stderr);
12+
});
1013
});
11-
});
14+
console.log('Command output:', output);
15+
} catch (error) {
16+
console.error('Command failed with error:', error);
17+
}
1218
}
1319

14-
runCommand().finally(() => {
15-
process.exit(0);
16-
});
20+
runCommand();

0 commit comments

Comments
 (0)