parent
2085b6d797
commit
0298630114
@ -146,7 +146,7 @@ func loadFiles() (list []string, copy bool, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func sendServer(cmd string) error {
|
||||
func sendRemote(cmd string) error {
|
||||
c, err := net.Dial("unix", gSocketPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("dialing to send server: %s", err)
|
||||
|
4
eval.go
4
eval.go
@ -274,7 +274,7 @@ func (e *callExpr) eval(app *app, args []string) {
|
||||
return
|
||||
}
|
||||
app.nav.marks = make(map[string]bool)
|
||||
if err := sendServer("send sync"); err != nil {
|
||||
if err := sendRemote("send sync"); err != nil {
|
||||
msg := fmt.Sprintf("yank: %s", err)
|
||||
app.ui.message = msg
|
||||
log.Printf(msg)
|
||||
@ -287,7 +287,7 @@ func (e *callExpr) eval(app *app, args []string) {
|
||||
return
|
||||
}
|
||||
app.nav.marks = make(map[string]bool)
|
||||
if err := sendServer("send sync"); err != nil {
|
||||
if err := sendRemote("send sync"); err != nil {
|
||||
msg := fmt.Sprintf("delete: %s", err)
|
||||
app.ui.message = msg
|
||||
log.Printf(msg)
|
||||
|
12
main.go
12
main.go
@ -72,6 +72,7 @@ func startServer() {
|
||||
|
||||
func main() {
|
||||
showDoc := flag.Bool("doc", false, "show documentation")
|
||||
remoteCmd := flag.String("remote", "", "send remote command to server")
|
||||
serverMode := flag.Bool("server", false, "start server (automatic)")
|
||||
cpuprofile := flag.String("cpuprofile", "", "path to the file to write the cpu profile")
|
||||
flag.StringVar(&gLastDirPath, "last-dir-path", "", "path to the file to write the last dir on exit (to use for cd)")
|
||||
@ -84,13 +85,20 @@ func main() {
|
||||
return
|
||||
}
|
||||
|
||||
if *remoteCmd != "" {
|
||||
if err := sendRemote(*remoteCmd); err != nil {
|
||||
log.Fatalf("remote command: %s", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if *cpuprofile != "" {
|
||||
f, err := os.Create(*cpuprofile)
|
||||
if err != nil {
|
||||
log.Fatal("could not create CPU profile: ", err)
|
||||
log.Fatalf("could not create CPU profile: %s", err)
|
||||
}
|
||||
if err := pprof.StartCPUProfile(f); err != nil {
|
||||
log.Fatal("could not start CPU profile: ", err)
|
||||
log.Fatalf("could not start CPU profile: %s", err)
|
||||
}
|
||||
defer pprof.StopCPUProfile()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user