Skip to content

deploy option 'needs_tty' fails with "Pseudo-terminal will not be allocated because stdin is not a terminal." #2231

Description

@mozeryansky

What I'm attempting to do is run su in a post-deploy. To do this, I know I need a tty which is achieved with -t. I found in the source of deploy that if I include needs_tty then a -t will be used on the ssh commands for deploy. However, when I do this, all the ssh commands output "Pseudo-terminal will not be allocated because stdin is not a terminal."

I believe this is because the deploy command is passed the config string by piping in the string, instead of passing it as an argument.

Environment info

Operating System: OS X 10.11.5
Pm2 version: 1.1.3
Node version: 5.3.0
Shell: bash

Steps to reproduce

  1. In the ecosystem.json file include in the deploy section: "needs_tty": "yes". I don't think this was documented but I found in the source that it will add -t when doing ssh commands, which I need.
  2. Run deploy: pm2 deploy production

Logs

The pm2 log doesn't apply here, so this is from '/tmp/pm2-deploy.log'. From the logs, it looks like everything is operating correctly.

ssh -t username@website.com "cd /home/bob/source && git fetch --all"
ssh -t username@website.com "cd /home/bob/source && git reset --hard origin/master"
ssh -t username@website.com "ln -sfn /home/bob/source /home/bob/current"
ssh -t username@website.com "cd /home/bob/source && echo git rev-parse --short HEAD >> /home/bob/.deploys"
ssh -t username@website.com "cd /home/bob/current; SHARED="/home/bob/shared" su bob pm2 startOrRestart ecosystem.json --env production 2>&1 | tee -a /tmp/pm2-deploy.log; exit ${PIPESTATUS[0]}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions