Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle quoted empty string argument. #41

Closed
andyjbgm opened this issue Oct 19, 2012 · 0 comments
Closed

Handle quoted empty string argument. #41

andyjbgm opened this issue Oct 19, 2012 · 0 comments

Comments

@andyjbgm
Copy link

Trying to generate ssh keys:

keygen = local['ssh-keygen']
keygen('-t', 'rsa', '-N', '', '-f', 't_key.pub')

results in:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/plumbum/commands.py", line 219, in __call__
    return self.run(args, **kwargs)[1]
  File "/usr/lib/python2.7/site-packages/plumbum/commands.py", line 275, in run
    return run_proc(p, retcode, timeout)
  File "/usr/lib/python2.7/site-packages/plumbum/commands.py", line 173, in run_proc
    stdout, stderr)
plumbum.commands.ProcessExecutionError: Command line: ['/usr/bin/ssh-keygen', '-t', 'rsa', '-N', '-f', 't_key.pub']
Exit code: 1
Stdout:  | Too many arguments.

i.e. the empty single quoted passphrase for -N is ignored.

Whereas the subprocess equivalent works as expected.

>>> com = ['ssh-keygen', '-t', 'rsa', '-N', '', '-f', 't_key.pub']
>>> r = subprocess.Popen(com, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>>> r.returncode
>>> (output, error) = r.communicate()
>>> r.returncode
0
>>> output
"Generating public/private rsa key pair.\nYour identification has been saved in t_key.pub.\nYour public key has been saved in t_key.pub.pub.\nThe key fingerprint is:\n16:28:94:a5:73:e0:56:1f:73:88:b1:86:e4:32:8a:28 andy@vmandy.getme\nThe key's randomart image is:\n+--[ RSA 2048]----+\n|    +o+oo..      |\n|   =.=.+.+       |\n|  o O = o        |\n|o. + =   .       |\n|E       S        |\n|.      .         |\n|                 |\n|                 |\n|                 |\n+-----------------+\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants