1
0
Fork 0

same as prev

refactor/models
Bsian 2020-01-01 21:37:20 +00:00
parent e9430a85e6
commit 41f42c2f9d
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 2 additions and 2 deletions

View File

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