forked from engineering/cloudservices
Linting
parent
ce01f5d290
commit
17760f41c4
|
@ -14,10 +14,10 @@ export default class Util {
|
||||||
public async exec(command: string): Promise<string> {
|
public async exec(command: string): Promise<string> {
|
||||||
const ex = promisify(childProcess.exec);
|
const ex = promisify(childProcess.exec);
|
||||||
let result: string;
|
let result: string;
|
||||||
|
// eslint-disable-next-line no-useless-catch
|
||||||
try {
|
try {
|
||||||
const res = await ex(command);
|
const res = await ex(command);
|
||||||
if (res.stderr) result = res.stderr;
|
result = res.stderr || res.stdout;
|
||||||
else result = res.stdout;
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,11 @@ export default class Util {
|
||||||
public resolveCommand(command: string): Command {
|
public resolveCommand(command: string): Command {
|
||||||
if (this.client.commands.has(command)) return this.client.commands.get(command);
|
if (this.client.commands.has(command)) return this.client.commands.get(command);
|
||||||
for (const cmd of this.client.commands.values()) {
|
for (const cmd of this.client.commands.values()) {
|
||||||
if (!cmd.aliases) continue;
|
if (!cmd.aliases) continue;// eslint-disable-line no-continue
|
||||||
for (const alias of cmd.aliases) {
|
for (const alias of cmd.aliases) {
|
||||||
if (command === alias.toLowerCase()) return cmd;
|
if (command === alias.toLowerCase()) return cmd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue