Add eslogger completion and Go tools
This commit is contained in:
29
tools/go/gopname/pname.go
Normal file
29
tools/go/gopname/pname.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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.")
|
||||
}
|
||||
Reference in New Issue
Block a user