Skip to content

Commit

Permalink
some terminal commands open hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
mdrichardson committed Jul 31, 2019
1 parent 6f9e491 commit df6a17a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/commands/emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const emulatorCommands: Commands = {
var command = getEmulatorLaunchCommand('http://localhost:3978/api/messages');
// Note: We have to open the bfemulator:// links through a terminal. vscode.env.openExternal decodes the / in URL, which doesn't work with emulator
// Waiting on this issue to be fixed so we can auto-close the terminal: https://github.com/Microsoft/BotFramework-Emulator/issues/1136
await executeTerminalCommand(command);
await executeTerminalCommand(command, undefined, { runInBackground: true });
// await executeTerminalCommand(command, constants.regex.forDispose.Emulator, 'Emulator Launch');
},
async openEmulatorLocalhostWithApp(): Promise<void> {
Expand All @@ -22,7 +22,7 @@ const emulatorCommands: Commands = {

vscode.window.showInformationMessage('Opening Emulator at localhost');
const command = getEmulatorLaunchCommand('http://localhost:3978/api/messages', { appId, appPassword });
await executeTerminalCommand(command);
await executeTerminalCommand(command, undefined, { runInBackground: true });
},
async openEmulatorProduction(): Promise<void> {
const endpoint = await getSingleEndpoint();
Expand All @@ -33,7 +33,7 @@ const emulatorCommands: Commands = {
appId: endpoint.AppId,
appPassword: endpoint.AppPassword,
});
await executeTerminalCommand(command);
await executeTerminalCommand(command, undefined, { runInBackground: true });
} else { log('No Endpoint Found'); }
}
};
Expand Down
15 changes: 8 additions & 7 deletions src/utilities/deployment/executeTerminalCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,22 @@ import { joinTerminalCommands } from './joinTerminalCommands';

export async function executeTerminalCommand(
command: string|string[],
options: CommandOptions = {
commandOptions: CommandOptions = {
commandTitle: 'Command',
isTest: false,
}): Promise<boolean|RegExpExecArray|Partial<BotVariables>> {
},
terminalOptions: vscode.TerminalOptions = {}): Promise<boolean|RegExpExecArray|Partial<BotVariables>> {

const terminalPath = await getTerminalPath();
terminalOptions.shellPath = terminalOptions.shellPath ? terminalOptions.shellPath : await getTerminalPath();

if (Array.isArray(command)) {
command = joinTerminalCommands(command, terminalPath);
command = joinTerminalCommands(command, terminalOptions.shellPath);
}

const terminal = await vscode.window.createTerminal(undefined, terminalPath);
terminal.show(true);
const terminal = await vscode.window.createTerminal(terminalOptions);
// terminal.show(true);

terminal.sendText(command, true);

return await handleTerminalData(terminal, options);
return await handleTerminalData(terminal, commandOptions);
}
2 changes: 1 addition & 1 deletion src/utilities/tools/getCurrentAzCliVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export async function getCurrentAzCliVersion(isTest?: boolean): Promise<string>
returnRegex: constants.regex.forVariables.AzCliVersion,
timeout: 10000,
};
const matches = (await executeTerminalCommand('az -v', options) as RegExpExecArray);
const matches = (await executeTerminalCommand('az -v', options, { runInBackground: true }) as RegExpExecArray);
return matches.groups && matches.groups['version'] ? matches['groups']['version'] : '0.0.0';
}

0 comments on commit df6a17a

Please sign in to comment.