diff --git a/src/class/Util.ts b/src/class/Util.ts index e8580de..a24364d 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -29,11 +29,11 @@ export default class Util { * @param command The command to execute * @param options childProcess.ExecOptions, the env option is automatically set if not provided. */ - public async exec(command: string, options?: childProcess.ExecOptions): Promise { + public async exec(command: string, options: childProcess.ExecOptions = {}): Promise { const ex = promisify(childProcess.exec); let result: string; try { - if (!options || (!options.env)) options.env = { HOME: '/root' }; + if (!options.env) options.env = { HOME: '/root' }; const res = await ex(command, options); result = res.stderr || res.stdout; } catch (err) {