shell: make shell.sudo promise based and waitable
This commit is contained in:
+2
-2
@@ -167,14 +167,14 @@ async function addLogrotateConfig(app) {
|
||||
safe.fs.writeFileSync(tmpFilePath, logrotateConf);
|
||||
if (safe.error) throw new BoxError(BoxError.FS_ERROR, `Error writing logrotate config: ${safe.error.message}`);
|
||||
|
||||
const [error] = await safe(shell.promises.sudo([ CONFIGURE_LOGROTATE_CMD, 'add', app.id, tmpFilePath ], {}));
|
||||
const [error] = await safe(shell.sudo([ CONFIGURE_LOGROTATE_CMD, 'add', app.id, tmpFilePath ], {}));
|
||||
if (error) throw new BoxError(BoxError.LOGROTATE_ERROR, `Error adding logrotate config: ${error.message}`);
|
||||
}
|
||||
|
||||
async function removeLogrotateConfig(app) {
|
||||
assert.strictEqual(typeof app, 'object');
|
||||
|
||||
const [error] = await safe(shell.promises.sudo([ CONFIGURE_LOGROTATE_CMD, 'remove', app.id ], {}));
|
||||
const [error] = await safe(shell.sudo([ CONFIGURE_LOGROTATE_CMD, 'remove', app.id ], {}));
|
||||
if (error) throw new BoxError(BoxError.LOGROTATE_ERROR, `Error removing logrotate config: ${error.message}`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user