Skip to content

Commit dba8f7b

Browse files
authored
Merge pull request #189 from PedroManuelAtienzaHuerta/main
Update restart-webdav.js
2 parents 44f1b0c + aa46066 commit dba8f7b

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)