diff --git a/cmd/elc.go b/cmd/elc.go index 4121c3c..4f8775e 100644 --- a/cmd/elc.go +++ b/cmd/elc.go @@ -16,6 +16,7 @@ func parseStartFlags(cmd *cobra.Command) { func parseExecFlags(cmd *cobra.Command) { cmd.Flags().IntVar(&globalOptions.UID, "uid", -1, "use another uid, by default uses uid of current user") + cmd.Flags().BoolVar(&globalOptions.NoTty, "no-tty", false, "disable pseudo-TTY allocation") } func InitCobra() *cobra.Command { diff --git a/core/component.go b/core/component.go index 0b4256a..baeb37b 100644 --- a/core/component.go +++ b/core/component.go @@ -286,7 +286,7 @@ func (comp *Component) Exec(options *GlobalOptions) (int, error) { command = append(command, "-u", fmt.Sprintf("%s:%s", userId, groupId)) } - if !Pc.IsTerminal() { + if options.NoTty || !Pc.IsTerminal() { command = append(command, "-T") } command = append(command, "app") diff --git a/core/core.go b/core/core.go index 9ec7862..e6c166d 100644 --- a/core/core.go +++ b/core/core.go @@ -20,6 +20,7 @@ type GlobalOptions struct { UID int Tag string DryRun bool + NoTty bool } func contains(list []string, item string) bool { @@ -94,7 +95,7 @@ func GenerateHookScript(scripts []string, elcBinary string) string { result = append(result, "set -e") result = append(result, `printf "\x1b[0;34m%s\x1b[39;49;00m\n" "Run hook in ELC"`) for _, script := range scripts { - result = append(result, fmt.Sprintf("%s --mode=hook %s", elcBinary, script)) + result = append(result, fmt.Sprintf("%s --mode=hook --no-tty %s", elcBinary, script)) } return strings.Join(result, "\n")