@@ -50,7 +50,10 @@ import { ArrayDelRepetition } from "../lib/node-utility/Utility";
5050import { DependenceManager } from "./DependenceManager" ;
5151import { WorkspaceManager } from "./WorkspaceManager" ;
5252import { ToolchainName } from "./ToolchainManager" ;
53- import { md5 , sha256 , copyObject , generateDotnetProgramCmd , generateRandomStr , isGccFamilyToolchain } from "./utility" ;
53+ import {
54+ md5 , sha256 , copyObject , generateDotnetProgramCmd , generateRandomStr ,
55+ isGccFamilyToolchain , compareVersion
56+ } from "./utility" ;
5457import { exeSuffix , osType } from "./Platform" ;
5558import { FileWatcher } from "../lib/node-utility/FileWatcher" ;
5659import { STVPFlasherOptions } from './HexUploader' ;
@@ -300,12 +303,20 @@ export abstract class CodeBuilder {
300303 if ( SettingManager . GetInstance ( ) . isUseTaskToBuild ( ) &&
301304 WorkspaceManager . getInstance ( ) . hasWorkspaces ( ) ) { // use vscode task
302305 // setup shell
303- const shellOption : vscode . ShellExecutionOptions = { } ;
304- if ( os . platform ( ) == 'win32' ) { shellOption . executable = 'cmd.exe' ; shellOption . shellArgs = [ '/C' ] ; }
305- else { shellOption . executable = '/bin/bash' ; shellOption . shellArgs = [ '-c' ] ; }
306- shellOption . env = < any > process . env ;
306+ const shellOption : vscode . ShellExecutionOptions = {
307+ env : < any > process . env
308+ } ;
309+ if ( os . platform ( ) == 'win32' ) {
310+ shellOption . executable = 'cmd.exe' ;
311+ shellOption . shellArgs = [ '/D' , '/C' ] ;
312+ // FIXME: https://github.com/microsoft/vscode/issues/260534
313+ if ( compareVersion ( vscode . version , '1.103.0' ) < 0 )
314+ commandLine = `"${ commandLine } "` ;
315+ } else {
316+ shellOption . executable = '/bin/bash' ;
317+ shellOption . shellArgs = [ '-c' ] ;
318+ }
307319 // setup task
308- if ( os . platform ( ) == 'win32' ) commandLine = `"${ commandLine } "` ;
309320 const task = new vscode . Task ( { type : 'shell' , command : commandLine } , vscode . TaskScope . Workspace ,
310321 title , 'eide.builder' , new vscode . ShellExecution ( commandLine , shellOption ) , [ ] ) ;
311322 task . group = vscode . TaskGroup . Build ;
@@ -317,10 +328,12 @@ export abstract class CodeBuilder {
317328 }
318329 vscode . tasks . executeTask ( task ) ;
319330 } else { // use terminal
320- const index = vscode . window . terminals . findIndex ( ( t ) => { return t . name === title ; } ) ;
321- if ( index !== - 1 ) { vscode . window . terminals [ index ] . dispose ( ) ; }
331+ const index = vscode . window . terminals . findIndex ( t => t . name === title ) ;
332+ if ( index !== - 1 )
333+ vscode . window . terminals [ index ] . dispose ( ) ;
322334 const opts : vscode . TerminalOptions = { name : title , iconPath : new vscode . ThemeIcon ( 'target' ) } ;
323- if ( os . platform ( ) == 'win32' ) { opts . shellPath = 'cmd.exe' ; } ;
335+ if ( os . platform ( ) == 'win32' )
336+ opts . shellPath = 'cmd.exe' ;
324337 opts . env = < any > process . env ;
325338 const terminal = vscode . window . createTerminal ( opts ) ;
326339 if ( ! SettingManager . GetInstance ( ) . isSilentBuildOrFlash ( ) )
0 commit comments