Skip to content

Commit

Permalink
echo -n is not sh-compatible
Browse files Browse the repository at this point in the history
Fixes NixOS#203
  • Loading branch information
shlevy committed Jun 23, 2014
1 parent 7e7407b commit 58cdd27
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions nixops/ssh_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import shlex
import subprocess
import weakref
import sys

from tempfile import mkdtemp

Expand Down Expand Up @@ -61,9 +62,10 @@ def _make_askpass_helper(self):
"""
path = os.path.join(self._tempdir, 'nixops-askpass-helper')
fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_NOFOLLOW, 0700)
os.write(fd, "#!{0}\necho -n \"$NIXOPS_SSH_PASSWORD\"".format(
nixops.util.which("sh")
))
os.write(fd, """#!{0}
import sys
import os
sys.stdout.write(os.environ['NIXOPS_SSH_PASSWORD'])""".format(sys.executable))
os.close(fd)
return path

Expand Down

0 comments on commit 58cdd27

Please sign in to comment.