File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed
Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation.
22// Licensed under the MIT license.
3- import { CLICommand , CLIContext , InputsWithProjectPath } from "@microsoft/teamsfx-api" ;
3+ import {
4+ CLICommand ,
5+ CLICommandOption ,
6+ CLIContext ,
7+ InputsWithProjectPath ,
8+ } from "@microsoft/teamsfx-api" ;
49import { QuestionNames , newResourceGroupOption } from "@microsoft/teamsfx-core" ;
510import { getFxCore } from "../../activate" ;
611import { commands } from "../../resource" ;
712import { TelemetryEvent } from "../../telemetry/cliTelemetryEvents" ;
813import { EnvOption , IgnoreLoadEnvOption , ProjectFolderOption } from "../common" ;
914
15+ const subscriptionOption : CLICommandOption = {
16+ name : "subscriptionId" ,
17+ questionName : "targetSubscriptionId" ,
18+ shortName : "sub" ,
19+ description : "Azure Subscription ID." ,
20+ type : "string" ,
21+ required : false ,
22+ default : "" ,
23+ } ;
24+
1025export const provisionCommand : CLICommand = {
1126 name : "provision" ,
1227 description : commands . provision . description ,
Original file line number Diff line number Diff line change @@ -638,7 +638,7 @@ class CLIUserInteraction implements UserInteraction {
638638 } ) : Promise < Result < string , FxError > > {
639639 return new Promise < Result < string , FxError > > ( ( resolve ) => {
640640 const isWindows = process . platform === "win32" ;
641- const command = isWindows ? "cmd.exe" : "/bin/bash" ;
641+ const command = args . shell ? args . shell : isWindows ? "cmd.exe" : "/bin/bash" ;
642642 const commandArgs = isWindows ? [ "/c" , args . cmd ] : [ "-c" , args . cmd ] ;
643643 logger . info ( `Executing task: ${ args . cmd } ` ) ;
644644 let output = "" ;
Original file line number Diff line number Diff line change @@ -329,6 +329,22 @@ describe("runCommand", () => {
329329 assert . isTrue ( spawnStub . calledOnce ) ;
330330 assert . equal ( spawnStub . firstCall . args [ 0 ] , "cmd.exe" ) ;
331331 } ) ;
332+ it ( "uses custom shell" , async ( ) => {
333+ const mockChildProcess = {
334+ on : sandbox . stub ( ) . callsFake ( ( event , callback ) => {
335+ if ( event === "close" ) {
336+ callback ( 0 ) ;
337+ }
338+ } ) ,
339+ } ;
340+ sandbox . stub ( process , "platform" ) . value ( "win32" ) ;
341+ sandbox . stub ( logger , "info" ) . returns ( ) ;
342+ const spawnStub = sandbox . stub ( child_process , "spawn" ) . returns ( mockChildProcess as any ) ;
343+ const res = await UI . runCommand ( { cmd : "echo hello" , shell : "powershell.exe" } ) ;
344+ assert . isTrue ( res . isOk ( ) ) ;
345+ assert . isTrue ( spawnStub . calledOnce ) ;
346+ assert . equal ( spawnStub . firstCall . args [ 0 ] , "powershell.exe" ) ;
347+ } ) ;
332348 it ( "error linux" , async ( ) => {
333349 const mockChildProcess = {
334350 on : sandbox . stub ( ) . callsFake ( ( event , callback ) => {
You can’t perform that action at this time.
0 commit comments