On Wed, Feb 13, 2013 at 03:24:18PM -0000, Robert Roth wrote: > Robert Roth has proposed merging lp:~evfool/software-properties/lp1060192 into lp:software-properties. > > Commit message: > - Do not use Shell=True unnecessarily in subprocess.Popen (bug #1060192) [..]
Great! Thanks for working on this!
> self.parent.report_action("Pinging %s..." % host) > - commando = subprocess.Popen("ping -q -c 2 -W 1 -i 0.5 %s" % host, > - shell=True, stdout=subprocess.PIPE, > + commando = subprocess.Popen(["ping", "-q", "-c 2", "-W 1", "-i 0.5", host], > + stdout=subprocess.PIPE, > stderr=subprocess.STDOUT, > universal_newlines=True).stdout > while True:
You can also go one step further and do ["ping", "-c", "2", "-W", "1"...].
But ping is fine with both. Thanks again for getting rid of the shell=True.
Cheers, Michael
« Back to merge proposal
On Wed, Feb 13, 2013 at 03:24:18PM -0000, Robert Roth wrote:
> Robert Roth has proposed merging lp:~evfool/software-properties/lp1060192 into lp:software-properties.
>
> Commit message:
> - Do not use Shell=True unnecessarily in subprocess.Popen (bug #1060192)
[..]
Great! Thanks for working on this!
> self.parent. report_ action( "Pinging %s..." % host) Popen(" ping -q -c 2 -W 1 -i 0.5 %s" % host, subprocess. PIPE, Popen([ "ping", "-q", "-c 2", "-W 1", "-i 0.5", host], subprocess. PIPE, subprocess. STDOUT, newlines= True).stdout
> - commando = subprocess.
> - shell=True, stdout=
> + commando = subprocess.
> + stdout=
> stderr=
> universal_
> while True:
You can also go one step further and do ["ping", "-c", "2", "-W",
"1"...].
But ping is fine with both. Thanks again for getting rid of the
shell=True.
Cheers,
Michael