Wiki

Ticket #147: embed-spaces-cmdline.patch

File embed-spaces-cmdline.patch, 2.5 KB (added by hopscc, 9 years ago)
  • Source/Compiler.cobra

     
    560560 
    561561        if argList and argList.count  
    562562            args = p.startInfo.arguments ? ''  
    563             args += Utils.join(' ', argList)  
    564             p.startInfo.arguments = args                 
     563            hasSpaces = any for a in argList where ' ' in a 
     564            if hasSpaces  
     565                modArgList = List<of String>() 
     566                for a in argList 
     567                    newArg = if(' ' in a, '"[a]"', a) 
     568                    modArgList.add(newArg) 
     569                args += Utils.join(' ', modArgList)  
     570            else 
     571                args += Utils.join(' ', argList)  
     572            p.startInfo.arguments = args  
    565573        return p 
    566574 
    567575    ## 
  • Tests/700-command-line/700-run-args.cobra

     
    1313        .verify(cobraPath, '[echo] -- argA argB argC', 'argA argB argC') 
    1414        .verify(cobraPath, '[echo] -run-args x1arg1 x1argB x1argC', 'x1arg1 x1argB x1argC') 
    1515        .verify(cobraPath, '-r [echo] -run-args x2arg1 x2argB x2argC', 'x2arg1 x2argB x2argC') 
     16        .verify(cobraPath, '[echo] -- "argA argB argC"', 'argA argB argC :1') 
     17        # below exercises broken windows process quoting with '' 
     18        #.verify(cobraPath, "[echo] -- 'argA1 argB1 argC1'", 'argA1 argB1 argC1 :1') 
    1619     
    1720    def verify(cobraPath as String, cmdln as String, expectedText as String)is shared 
    1821        p as System.Diagnostics.Process?  
  • Tests/700-command-line/702-echo.cobra

     
    66        for a in args[1:] 
    77            print '[sep][a]' stop 
    88            sep = ' ' 
     9        if args.count >1 
     10            print ' :[args.count-1]' stop    
    911        print 
  • Developer/IntermediateReleaseNotes.text

     
    324324* Fixed: An unterminated doc string gives an internal error instead of a friendly error message. 
    325325 
    326326* Fixed: Using a type from a binary library with internal methods referring to internal types caused an uncaught exception in the compiler. 
     327 
     328* Fixed: String parameters with spaces in commandline.  ticket:147