question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use command parameters that have embedded quotes?

See original GitHub issue

For example:

command = '/usr/bin/xvfb-run -a -s "-screen 0 1600x1200x24" ...'
c.create_container(image=settings.MYIMAGE, stdin_open=True, tty=True, command=command)

The resulting command always strips out the double quotes, resulting in failures. I’ve tried everything I can think of to escape, but the result is always:

/usr/bin/xvfb-run -a -s -screen 0 1600x1200x24 ...

Which isn’t really what I need.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

15reactions
mkoistinencommented, Oct 22, 2014

Haven’t tried. Sorry, I found a solution and ran with it.

3reactions
mpetazzonicommented, Dec 17, 2015

FWIW when you use a list for the command, you don’t need quotes at all. Each element of the list is exactly one command line argument, even if it contains spaces.

command = ['/usr/bin/xvfb-run', '-a', '-s', '-screen 0 1600x1200x24', '...']

HTH

Read more comments on GitHub >

github_iconTop Results From Across the Web

Embedding Double Quotes in the Command - ITPro Today
The command-line parser uses the double quote (") character as an argument delimiter; that is, an argument can contain spaces if it's enclosed...
Read more >
Quotes, Escape Characters, Delimiters - Windows CMD - SS64
How-to: Escape Characters, Delimiters and Quotes at the Windows command line. Delimiters. Delimiters separate one parameter from the next - they split the ......
Read more >
windows - Escape double quotes in parameter - Stack Overflow
A double-quoted group ignores spaces as value separators when passing parameters to programs: program one two "three and more" will pass three parameters...
Read more >
Passing command line args with quotes - TechNet - Microsoft
Define your script parameters using a param block a the top of the script. Then you can use your parameters from the command...
Read more >
Shell Command Line Quoting Mechanisms - Ian! D. Allen
Note that quotes and backslashes are themselves meta-characters to the shell, so if you want quotes and backslashes to appear in command line...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found