30 lines
664 B
Go
30 lines
664 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
|
|
"github.com/erikdubbelboer/gspt" // Import the new library
|
|
)
|
|
|
|
func main() {
|
|
// Change the process title using the library
|
|
gspt.SetProcTitle("notmyname")
|
|
|
|
fmt.Println("Process name changed. Press any key to exit...")
|
|
|
|
// Disable input buffering
|
|
exec.Command("stty", "-F", "/dev/tty", "cbreak", "min", "1").Run()
|
|
// Do not display entered characters on the screen
|
|
exec.Command("stty", "-F", "/dev/tty", "-echo").Run()
|
|
|
|
var b []byte = make([]byte, 1)
|
|
os.Stdin.Read(b)
|
|
|
|
// Restore the original terminal settings
|
|
exec.Command("stty", "-F", "/dev/tty", "sane").Run()
|
|
|
|
fmt.Println("\nKey pressed. Exiting.")
|
|
}
|