Skip to content

os/exec: unable to change terminal control capabilities with Setctty/Setsid #5079

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

Closed
gopherbot opened this issue Mar 19, 2013 · 8 comments
Closed
Milestone

Comments

@gopherbot
Copy link
Contributor

by charmes.guillaume:

Impossible to change terminal control capabilities.

Depending on the capability you try to set, you get: operation not supported by device,
operation denied, bad file descriptor.

I tried also directly using syscall.Rawsyscall of IOCTL, but get same result.

With os.exec: http://play.golang.org/p/8BEJrHXlIM
Directly with syscall: http://play.golang.org/p/d864INMbEe

Tried on versions:
go version go1.0.2 (ubuntu)
go version devel +70a50cc39caf Fri Feb 15 13:13:19 2013 -0500 linux/amd64
go version go1.0.3 (osx)
go version devel +786e094255c9 Tue Mar 19 07:08:26 2013 +0100 darwin/amd64
@remyoudompheng
Copy link
Contributor

Comment 1:

You have to set the Stdout/Stderr properties when using exec.Command.

@gopherbot
Copy link
Contributor Author

Comment 2 by charmes.guillaume:

I tried with os.Std* but still have the same thing.
http://play.golang.org/p/LK0Xyx857L

@gopherbot
Copy link
Contributor Author

Comment 3 by jeff.allen:

From the tty_ioctl manpage on Linux:
TIOCSCTTY int arg
              Make  the given terminal the controlling terminal of the calling
              process.  The calling process must be a session leader  and  not
              have  a  controlling  terminal  already.   If  this  terminal is
              already the controlling terminal of a  different  session  group
              then the ioctl fails with EPERM, unless the caller is root (more
              precisely: has the CAP_SYS_ADMIN capability) and arg  equals  1,
              in which case the terminal is stolen, and all processes that had
              it as controlling terminal lose it.
It seems to me EPERM may be correct here. What are you trying to do? What does it look
like in C when it's working right?

@davecheney
Copy link
Contributor

Comment 4:

Status changed to WaitingForReply.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 5:

Labels changed: added priority-later, go1.2maybe, removed priority-triage.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 6:

Labels changed: added feature.

@gopherbot
Copy link
Contributor Author

Comment 7 by charmes.guillaume:

I haven't been able to make it work directly, but it works fine with
https://github.com/kr/pty. I guess we can close this issue.

@rsc
Copy link
Contributor

rsc commented Jul 31, 2013

Comment 8:

Status changed to Retracted.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants