Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
7ff25366
Commit
7ff25366
authored
May 18, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- make godoc restart feature work properly
R=rsc DELTA=11 (10 added, 0 deleted, 1 changed) OCL=29007 CL=29009
parent
89df0711
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
godoc.go
usr/gri/pretty/godoc.go
+11
-1
No files found.
usr/gri/pretty/godoc.go
View file @
7ff25366
...
...
@@ -58,6 +58,7 @@ var (
verbose
=
flag
.
Bool
(
"v"
,
false
,
"verbose mode"
);
// file system roots
launchdir
string
;
// directory from which godoc was launched
goroot
string
;
pkgroot
=
flag
.
String
(
"pkgroot"
,
"src/lib"
,
"root package source directory (if unrooted, relative to goroot)"
);
tmplroot
=
flag
.
String
(
"tmplroot"
,
"usr/gri/pretty"
,
"root template directory (if unrooted, relative to goroot)"
);
...
...
@@ -585,7 +586,10 @@ func loggingHandler(h http.Handler) http.Handler {
func
restartGodoc
(
c
*
http
.
Conn
,
r
*
http
.
Request
)
{
binary
:=
os
.
Args
[
0
];
// TODO currently requires absolute paths because of chdir in the beginning
binary
:=
os
.
Args
[
0
];
if
len
(
binary
)
>
0
||
binary
[
0
]
!=
'/'
{
binary
=
pathutil
.
Join
(
launchdir
,
binary
);
}
pid
,
err
:=
os
.
ForkExec
(
binary
,
os
.
Args
,
os
.
Environ
(),
""
,
[]
*
os
.
File
{
os
.
Stdin
,
os
.
Stdout
,
os
.
Stderr
});
if
err
!=
nil
{
log
.
Stderrf
(
"os.ForkExec(%s): %v"
,
binary
,
err
);
...
...
@@ -621,6 +625,12 @@ func main() {
}
}
var
err
os
.
Error
;
if
launchdir
,
err
=
os
.
Getwd
();
err
!=
nil
{
log
.
Stderrf
(
"unable to determine current working directory - restart may fail"
);
launchdir
=
""
;
}
if
err
:=
os
.
Chdir
(
goroot
);
err
!=
nil
{
log
.
Exitf
(
"chdir %s: %v"
,
goroot
,
err
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment