Hi Greg, Paths with spaces will work because we split from the right and at most once. So unless you provide an invalid syntax to the function (which we control through the test) it should work fine.
I’m not saying that my hand rolled thingy replaces shlex in general, but it should do the right thing for this simple test. Cheers, Jonas On Thu, Apr 11, 2019 at 23:18 Greg Clayton <clayb...@gmail.com> wrote: > So if there is a space in the path this will fail? shlex does really > complex stuff like turn: > > "hello"' world' > > into one "hello world" argument. If this is just for one controlled test > whose arguments are guaranteed to no ever have any quotes or desensitized > spaces like: > > hello\ world > > Then it is ok, but not ok to just call the small new "split" function you > added a replacement for shlex? > > Greg > > > On Apr 11, 2019, at 12:36 PM, Jonas Devlieghere via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > > > > Author: jdevlieghere > > Date: Thu Apr 11 12:36:53 2019 > > New Revision: 358216 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=358216&view=rev > > Log: > > [test] Fix & re-enable CommandScriptImmediateOutputFile on Windows > > > > Apparently the shlex module produces garbage on Windows. I've added a > > hand rolled split instead that should suffice for this test. > > > > Modified: > > > lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test > > > lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py > > > > Modified: > lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test?rev=358216&r1=358215&r2=358216&view=diff > > > ============================================================================== > > --- > lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test > (original) > > +++ > lldb/trunk/lit/Commands/CommandScriptImmediateOutput/CommandScriptImmediateOutputFile.test > Thu Apr 11 12:36:53 2019 > > @@ -1,5 +1,3 @@ > > -# UNSUPPORTED: system-windows > > - > > # Test that LLDB correctly allows scripted commands to set immediate > output to > > # a file. > > > > > > Modified: > lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py > > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py?rev=358216&r1=358215&r2=358216&view=diff > > > ============================================================================== > > --- > lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py > (original) > > +++ > lldb/trunk/lit/Commands/CommandScriptImmediateOutput/Inputs/custom_command.py > Thu Apr 11 12:36:53 2019 > > @@ -1,16 +1,19 @@ > > from __future__ import print_function > > > > import sys > > -import shlex > > > > > > +def split(command): > > + command = command.strip() > > + return command.rsplit(' ', 1) > > + > > def command_function(debugger, command, exe_ctx, result, internal_dict): > > result.SetImmediateOutputFile(sys.__stdout__) > > print('this is a test string, just a test string', file=result) > > > > > > def write_file(debugger, command, exe_ctx, result, internal_dict): > > - args = shlex.split(command) > > + args = split(command) > > path = args[0] > > mode = args[1] > > with open(path, mode) as f: > > > > > > _______________________________________________ > > lldb-commits mailing list > > lldb-commits@lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > > -- Sent from my iPhone
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits