File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed
Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -2114,7 +2114,8 @@ class ExternalDebugConfigProvider implements vscode.DebugConfigurationProvider {
21142114 }
21152115 }
21162116 if ( flasherCfg . otherCmds )
2117- cliArgs . push ( flasherCfg . otherCmds ) ;
2117+ utility . parseCliArgs ( flasherCfg . otherCmds )
2118+ . forEach ( s => cliArgs . push ( s ) )
21182119 if ( flasherCfg . speed ) {
21192120 cliArgs . push ( '-f' ) ;
21202121 cliArgs . push ( flasherCfg . speed ) ;
Original file line number Diff line number Diff line change @@ -49,6 +49,45 @@ export const TIME_ONE_MINUTE = 60 * 1000;
4949export const TIME_ONE_HOUR = 3600 * 1000 ;
5050export const TIME_ONE_DAY = 24 * 3600 * 1000 ;
5151
52+ export function parseCliArgs ( cliStr : string ) : string [ ] {
53+
54+ let argsLi : string [ ] = [ ] ;
55+ let inQuote = false ;
56+ let curArg = '' ;
57+
58+ for ( let char_ of cliStr ) {
59+ // is a "..." start or end
60+ if ( char_ === '"' && ( curArg . length === 0 || curArg [ curArg . length - 1 ] !== '\\' ) ) {
61+ if ( inQuote ) {
62+ inQuote = false ;
63+ if ( curArg && curArg . trim ( ) !== '' )
64+ argsLi . push ( curArg ) ;
65+ curArg = '' ;
66+ } else {
67+ inQuote = true ;
68+ }
69+ continue ; // skip '"'
70+ }
71+ // in "..." region
72+ if ( inQuote ) {
73+ curArg += char_ ;
74+ } else { // out "..." region
75+ if ( char_ === ' ' || char_ === '\t' ) {
76+ if ( curArg && curArg . trim ( ) !== '' )
77+ argsLi . push ( curArg ) ;
78+ curArg = '' ;
79+ } else {
80+ curArg += char_ ;
81+ }
82+ }
83+ }
84+
85+ if ( curArg && curArg . trim ( ) !== '' )
86+ argsLi . push ( curArg ) ;
87+
88+ return argsLi ;
89+ }
90+
5291export async function probers_install ( cwd ?: string ) {
5392
5493 let commandLine : string ;
You can’t perform that action at this time.
0 commit comments