Fazlul Shahriar avatar Fazlul Shahriar committed 1489daf

use goplumb library instead of $PLAN9/bin/plumb

Comments (0)

Files changed (1)

 	"sort"
 	"flag"
 
+	"goplan9.googlecode.com/hg/plan9"
 	"goplan9.googlecode.com/hg/plan9/acme"
+	"bitbucket.org/fhs/goplumb/plumb"
 )
 
 var root string
 
 	if !fi.IsDirectory() {
 		// not a dir -> send that file to the plumber
-		if len(PLAN9) == 0 {
-			fmt.Fprintf(os.Stderr, "$PLAN9 not defined \n")
+		port, err := plumb.Open("send", plan9.OWRITE)
+		if err != nil {
+			fmt.Fprintf(os.Stderr, err.String())
 			return
 		}
-		var args2 []string = make([]string, 2)
-		args2[0] = path.Join(PLAN9 + "/bin/plumb")
-		args2[1] = fullpath
-		fds := []*os.File{os.Stdin, os.Stdout, os.Stderr}
-		os.ForkExec(args2[0], args2, os.Environ(), "", fds)
+		defer port.Close()
+		port.Send(&plumb.Msg{
+			Src:  "xplor",
+			Dst:  "",
+			WDir: "/",
+			Kind: "text",
+			Attr: map[string]string{},
+			Data: []byte(fullpath),
+		})
 		return
 	}
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.