shell: make shell.sudo promise based and waitable

This commit is contained in:
Girish Ramakrishnan
2025-07-16 21:53:22 +02:00
parent 32d07e7959
commit 989d843fcb
15 changed files with 86 additions and 64 deletions

View File

@@ -174,7 +174,7 @@ async function validateCertificate(subdomain, domain, certificate) {
async function notifyCertChange() {
await mailServer.checkCertificate();
await shell.promises.sudo([ RESTART_SERVICE_CMD, 'box' ], {}); // directory server
await shell.sudo([ RESTART_SERVICE_CMD, 'box' ], {}); // directory server
const allApps = (await apps.list()).filter(app => app.runState !== apps.RSTATE_STOPPED);
for (const app of allApps) {
if (app.manifest.addons?.tls) await setupTlsAddon(app);
@@ -184,7 +184,7 @@ async function notifyCertChange() {
async function reload() {
if (constants.TEST) return;
const [error] = await safe(shell.promises.sudo([ RESTART_SERVICE_CMD, 'nginx' ], {}));
const [error] = await safe(shell.sudo([ RESTART_SERVICE_CMD, 'nginx' ], {}));
if (error) throw new BoxError(BoxError.NGINX_ERROR, `Error reloading nginx: ${error.message}`);
}