1
0
Fork 0
refactor/models
Matthew 2020-07-01 17:54:32 -04:00
parent ba0ac57000
commit 1bc6b7c625
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ export default class Util {
* @param options childProcess.ExecOptions * @param options childProcess.ExecOptions
*/ */
public async exec(command: string, options: childProcess.ExecOptions = {}): Promise<string> { public async exec(command: string, options: childProcess.ExecOptions = {}): Promise<string> {
/* return new Promise((res, rej) => { return new Promise((res, rej) => {
let output = ''; let output = '';
const writeFunction = (data: string|Buffer|Error) => { const writeFunction = (data: string|Buffer|Error) => {
output += `${data}`; output += `${data}`;
@ -50,14 +50,14 @@ export default class Util {
if (code !== 0) rej(new Error(`Command failed: ${command}\n${output}`)); if (code !== 0) rej(new Error(`Command failed: ${command}\n${output}`));
res(output); res(output);
}); });
}); */ });
return new Promise((resolve, reject) => { /* return new Promise((resolve, reject) => {
childProcess.exec(command, options, (err, stdout, stderr) => { childProcess.exec(command, options, (err, stdout, stderr) => {
if (stderr) reject(new Error(`Command failed: ${command}\n${stderr}`)); if (stderr) reject(new Error(`Command failed: ${command}\n${stderr}`));
if (err) reject(err); if (err) reject(err);
resolve(stdout); resolve(stdout);
}); });
}); }); */
} }
public async sendMessageToUserTerminal(username: string, message: string): Promise<boolean> { public async sendMessageToUserTerminal(username: string, message: string): Promise<boolean> {