-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jelmer Vernooij wrote:
| Jelmer Vernooij has voted comment.
| Status is now: Waiting
| Comment:
| Is there no other way this can be done? I'd rather leave the escaping
| bits to the subprocess code and always specify a list of arguments.
|
| For details, see:
|
http://bundlebuggy.vernstok.nl/bzr-gtk//request/%3C486367A6.8080301%40gmail.com%3E
|

Just to comment briefly, you can use a [list] to Popen which should
avoid the need to quote escape. Specifically, something like:

args = ['diff', 'foo bar', 'baz']

should work.

I suppose the problem is you are getting a template which is a single
string and expanding it?

Could you just split the template like:

args = [expand_arg(arg) for arg in template.split()]

At least, assuming that the template string won't ever have junk
whitespace in it. So you'll have something like:

"$cmd $first $second $third"

which splits into

['$cmd', '$first', '$second', '$third']

Which is pretty much exactly what you would want to pass to Popen().

John
=:->



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhlBYgACgkQJdeBCYSNAAN+vgCfZThQwZoA4t7cXDlO0vkoGGfV
KdwAoJghb/6XUelPoo+h2LWSvmP9AHGP
=wnXW
-----END PGP SIGNATURE-----

-- 
bzr-gtk mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.canonical.com/mailman/listinfo/bzr-gtk

Reply via email to