Comments (1)
sake does not yet support interactive shells, it's something on the roadmap but no timeline available atm since I'm swamped with other stuff. The tty
parameter just means that the sake
command is replaced with the cmd
in the task which allows interactive use.
So for instance, given this task:
test:
tty: false
cmd: echo "Press enter to continue"; read var1
Basically without tty:
sake run <cmd>
- sake uses the ssh client to send text to a server which is executed on the server (note, the ssh client process is a child process of sake)
- User presses enter, nothing happens since it's not an interactive shell
With tty set to true:
sake run <cmd>
- sake replaces the current shell with the command (so it's not longer a child process but the main)
- User presses enter, you return to the shell
The code responsible for tty
:
func ExecTTY(cmd string, envs []string) error {
shell := "bash"
foundShell, found := os.LookupEnv("SHELL")
if found {
shell = foundShell
}
execBin, err := exec.LookPath(shell)
if err != nil {
return err
}
userEnv := append(os.Environ(), envs...)
err = unix.Exec(execBin, []string{shell, "-c", cmd}, userEnv)
if err != nil {
return err
}
return nil
}
There's 2 solutions I can think of to solve your problem:
-
Use sudoless password for the user? https://serverfault.com/questions/160581/how-to-setup-passwordless-sudo-on-linux, that's how I get around interactive prompts for sudo.
-
Write a custom
ssh
command using the-t
flag, see https://unix.stackexchange.com/questions/243821/run-a-command-in-an-interactive-shell-with-ssh-after-sourcing-bashrc, so something like:
test:
tty: true
cmd: ssh -t $S_USER@$S_HOST "read var1; echo 123"
from sake.
Related Issues (20)
- Should fail on non-zero exit HOT 11
- Configuration handling HOT 2
- Too many authentication failures when defining lots of servers HOT 2
- How do you pronounce sake? HOT 3
- How can a task pass a value to next task HOT 4
- error: strconv.ParseInt: parsing "": invalid syntax HOT 7
- Option to disable "Running" output HOT 1
- Sake vs Ansible? HOT 4
- Port out of range error when used in host string HOT 2
- Outdated docs and NPE when formatting table headers HOT 2
- Can't access libvirt hosts via dns name HOT 11
- Is there a way to specify an alternative user for ssh via flag? HOT 2
- Workdir for remote is being used by `local: true` task HOT 1
- ssh: handshake failed HOT 7
- Distinguish servers by server-name, port and user in output HOT 3
- Exec command with single quotes HOT 4
- Multiple bastions HOT 2
- Bug when using sake with .ssh/config HOT 3
- Bug ssh: handshake failed: ssh: unable to authenticate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sake.