Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(229)

Issue 6736069: code review 6736069: runtime, syscall, os: add os.ExecPath() (string, error)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 2 months ago by minux1
Modified:
11 years ago
CC:
golang-dev, ality
Visibility:
Public.

Description

runtime, syscall, os: add os.Executable() (string, error) which returns the path of the current executable. Fixes issue 4057.

Patch Set 1 #

Patch Set 2 : diff -r 8d919bfe75d3 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 8d919bfe75d3 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 8d919bfe75d3 https://code.google.com/p/go/ #

Patch Set 5 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 6 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 7 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 8 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 9 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 10 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 11 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 12 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Total comments: 1

Patch Set 13 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 14 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 15 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Total comments: 4

Patch Set 16 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 17 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 18 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 19 : diff -r 88c4bdf6cfb8 https://code.google.com/p/go/ #

Patch Set 20 : diff -r 19502dd66d65 https://code.google.com/p/go/ #

Patch Set 21 : diff -r 19502dd66d65 https://code.google.com/p/go/ #

Patch Set 22 : diff -r 19502dd66d65 https://code.google.com/p/go/ #

Total comments: 1

Patch Set 23 : diff -r 8df088298a0c https://code.google.com/p/go/ #

Patch Set 24 : diff -r 8df088298a0c https://code.google.com/p/go/ #

Total comments: 2

Patch Set 25 : diff -r 8df088298a0c https://code.google.com/p/go/ #

Patch Set 26 : diff -r fa727f5a7154 https://code.google.com/p/go/ #

Total comments: 1

Patch Set 27 : diff -r e6a9e019cafb https://code.google.com/p/go/ #

Patch Set 28 : diff -r 1c9411647150 https://code.google.com/p/go/ #

Patch Set 29 : diff -r 1c9411647150 https://code.google.com/p/go/ #

Patch Set 30 : diff -r 1c9411647150 https://code.google.com/p/go/ #

Patch Set 31 : diff -r dc4a3f6ba179 https://code.google.com/p/go/ #

Patch Set 32 : diff -r 617db9efbdf1 https://code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+267 lines, -0 lines) Patch
A src/pkg/os/executable.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +16 lines, -0 lines 0 comments Download
A src/pkg/os/executable_darwin.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +24 lines, -0 lines 0 comments Download
A src/pkg/os/executable_freebsd.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +33 lines, -0 lines 0 comments Download
A src/pkg/os/executable_plan9.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +11 lines, -0 lines 0 comments Download
A src/pkg/os/executable_procfs.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +24 lines, -0 lines 0 comments Download
A src/pkg/os/executable_test.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +79 lines, -0 lines 0 comments Download
A src/pkg/os/executable_windows.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1 chunk +31 lines, -0 lines 0 comments Download
A src/pkg/runtime/executable_darwin.c View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 chunk +20 lines, -0 lines 0 comments Download
M src/pkg/syscall/syscall_windows.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/syscall/zsyscall_windows_386.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 chunks +14 lines, -0 lines 0 comments Download
M src/pkg/syscall/zsyscall_windows_amd64.go View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 chunks +14 lines, -0 lines 0 comments Download

Messages

Total messages: 59
minux1
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go/
12 years, 2 months ago (2012-10-23 19:04:12 UTC) #1
minux1
I'd like to solicit opinion about the name and signature of the new func. package ...
12 years, 2 months ago (2012-10-23 19:05:44 UTC) #2
bradfitz
https://codereview.appspot.com/6736069/diff/8005/src/pkg/os/execpath_windows.go File src/pkg/os/execpath_windows.go (right): https://codereview.appspot.com/6736069/diff/8005/src/pkg/os/execpath_windows.go#newcode11 src/pkg/os/execpath_windows.go:11: // ExecPath returns the absolute pathname of the current ...
12 years, 2 months ago (2012-10-23 19:27:40 UTC) #3
bradfitz
I like the API addition, but the name sounds too imperative to me (like it's ...
12 years, 2 months ago (2012-10-23 19:27:57 UTC) #4
minux1
On Wed, Oct 24, 2012 at 3:27 AM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > I like the ...
12 years, 2 months ago (2012-10-23 19:37:48 UTC) #5
bradfitz
On Tue, Oct 23, 2012 at 12:37 PM, minux <minux.ma@gmail.com> wrote: > > On Wed, ...
12 years, 2 months ago (2012-10-23 19:48:54 UTC) #6
minux1
On Wed, Oct 24, 2012 at 3:48 AM, Brad Fitzpatrick <bradfitz@golang.org>wrote: > > On Tue, ...
12 years, 2 months ago (2012-10-23 19:56:15 UTC) #7
bradfitz
On Tue, Oct 23, 2012 at 12:55 PM, minux <minux.ma@gmail.com> wrote: > > On Wed, ...
12 years, 2 months ago (2012-10-23 21:33:26 UTC) #8
remyoudompheng
What about "ProgramPath"? unless program is ambiguous and could refer to source code?
12 years, 2 months ago (2012-10-23 21:35:17 UTC) #9
minux1
On Oct 24, 2012 5:33 AM, "Brad Fitzpatrick" <bradfitz@golang.org> wrote: > "Current" implies that it ...
12 years, 2 months ago (2012-10-24 04:15:53 UTC) #10
minux1
On Oct 24, 2012 5:35 AM, <remyoudompheng@gmail.com> wrote: > What about "ProgramPath"? unless program is ...
12 years, 2 months ago (2012-10-24 04:18:06 UTC) #11
brainman
LGTM, but wait for others. Alex http://codereview.appspot.com/6736069/diff/16026/src/pkg/os/execpath_test.go File src/pkg/os/execpath_test.go (right): http://codereview.appspot.com/6736069/diff/16026/src/pkg/os/execpath_test.go#newcode12 src/pkg/os/execpath_test.go:12: oexec "os/exec" why ...
12 years, 2 months ago (2012-10-24 04:19:15 UTC) #12
minux1
thank you. On Oct 24, 2012 12:19 PM, <alex.brainman@gmail.com> wrote: > http://codereview.appspot.com/6736069/diff/16026/src/pkg/os/execpath_test.go#newcode12 > src/pkg/os/execpath_test.go:12: oexec ...
12 years, 2 months ago (2012-10-24 04:31:11 UTC) #13
brainman
On 2012/10/24 04:31:11, minux wrote: > > ... > > Please, move this to os. ...
12 years, 2 months ago (2012-10-24 05:47:25 UTC) #14
taruti
We frequently run go things inside chroots without /proc - please don't make this impossible. ...
12 years, 2 months ago (2012-10-24 07:30:00 UTC) #15
minux1
On 2012/10/24 07:30:00, taruti wrote: > We frequently run go things inside chroots without /proc ...
12 years, 2 months ago (2012-10-24 08:12:42 UTC) #16
kardia
I'd personally like this to go it. If there is a dependency on /proc on ...
12 years, 2 months ago (2012-10-24 16:23:37 UTC) #17
bradfitz
ProcessPath is the best name I've heard. On Wed, Oct 24, 2012 at 9:23 AM, ...
12 years, 2 months ago (2012-10-24 20:08:05 UTC) #18
minux1
PTAL. Patch Set 22 is using the name ProgramPath. I've tested on Mac OS X ...
12 years, 2 months ago (2012-10-25 05:38:17 UTC) #19
brainman
https://codereview.appspot.com/6736069/diff/32004/src/pkg/os/progpath_test.go File src/pkg/os/progpath_test.go (right): https://codereview.appspot.com/6736069/diff/32004/src/pkg/os/progpath_test.go#newcode12 src/pkg/os/progpath_test.go:12: oexec "os/exec" You didn't tell me why you are ...
12 years, 2 months ago (2012-10-25 06:25:09 UTC) #20
minux1
On Thu, Oct 25, 2012 at 2:25 PM, <alex.brainman@gmail.com> wrote: > https://codereview.appspot.**com/6736069/diff/32004/src/** > pkg/os/progpath_test.go#**newcode12<https://codereview.appspot.com/6736069/diff/32004/src/pkg/os/progpath_test.go#newcode12> > ...
12 years, 2 months ago (2012-10-25 06:29:50 UTC) #21
brainman
On 2012/10/25 06:29:50, minux wrote: > ... > there is a function named exec in ...
12 years, 2 months ago (2012-10-25 06:32:08 UTC) #22
rsc
Sorry, but ProcessPath sounds like you are processing a path. Let's wait on this until ...
12 years, 2 months ago (2012-10-25 21:16:49 UTC) #23
r
how about "Executable"?
12 years, 2 months ago (2012-10-26 16:26:49 UTC) #24
minux1
On Saturday, October 27, 2012, Rob Pike wrote: > how about "Executable"? > without mentioning ...
12 years, 2 months ago (2012-10-26 16:31:18 UTC) #25
r
On Fri, Oct 26, 2012 at 9:31 AM, minux <minux.ma@gmail.com> wrote: > > On Saturday, ...
12 years, 2 months ago (2012-10-26 16:36:37 UTC) #26
minux1
On 2012/10/26 16:36:37, r wrote: > is your name minuxName? good point. PTAL. btw, how ...
12 years, 2 months ago (2012-10-28 15:43:54 UTC) #27
r
The file names are inappropriate now. For Plan 9, it depends what you want this ...
12 years, 2 months ago (2012-10-28 15:48:45 UTC) #28
minux1
On 2012/10/28 15:48:45, r wrote: > The file names are inappropriate now. do you have ...
12 years, 2 months ago (2012-10-28 15:57:44 UTC) #29
minux1
PTAL. Patch Set 24 is the same as Patch Set 23 except s/progpath/executable/ in filenames.
12 years, 2 months ago (2012-10-28 17:35:09 UTC) #30
r
i'm still not convinced by the idea behind this. the idea seems intrinsically too unportable ...
12 years, 2 months ago (2012-10-28 17:47:49 UTC) #31
minux1
On 2012/10/28 17:47:49, r wrote: https://codereview.appspot.com/6736069/diff/43014/src/pkg/os/executable.go#newcode7 > src/pkg/os/executable.go:7: // Executable returns the absolute pathname of ...
12 years, 2 months ago (2012-10-28 18:18:41 UTC) #32
ality
minux.ma@gmail.com once said: > On 2012/10/26 16:36:37, r wrote: > >is your name minuxName? > ...
12 years, 2 months ago (2012-10-29 01:06:08 UTC) #33
minux1
PTAL. All supported OSes have working implementations now. Except perhaps OpenBSD, where procfs is not ...
12 years, 2 months ago (2012-10-30 15:50:03 UTC) #34
ality
minux.ma@gmail.com once said: > On 2012/10/29 01:06:08, ality wrote: > >> btw, how to implement ...
12 years, 2 months ago (2012-10-30 21:13:50 UTC) #35
rsc
https://codereview.appspot.com/6736069/diff/37032/src/pkg/os/executable.go File src/pkg/os/executable.go (right): https://codereview.appspot.com/6736069/diff/37032/src/pkg/os/executable.go#newcode7 src/pkg/os/executable.go:7: // Executable returns the absolute pathname of the current ...
12 years, 2 months ago (2012-10-30 21:29:45 UTC) #36
minux1
On Wed, Oct 31, 2012 at 5:29 AM, <rsc@golang.org> wrote: > src/pkg/os/executable.go:7: // Executable returns ...
12 years, 2 months ago (2012-10-30 21:44:20 UTC) #37
r
Names are not unique, well-defined, or stable. It's the kind of thing that usually works ...
12 years, 2 months ago (2012-10-30 21:46:03 UTC) #38
kardia
As an observation, what you have mentioned is true, but is true for any path ...
12 years, 2 months ago (2012-10-31 03:42:01 UTC) #39
r
No one has answered Russ's question (and mine). What is this _for_? -rob
12 years, 2 months ago (2012-10-31 03:46:35 UTC) #40
kardia
This is what I currently use this call for on Windows, Linux, and darwin right ...
12 years, 2 months ago (2012-10-31 03:52:43 UTC) #41
rsc
Using "Executable" to find related files bothers me quite a bit. I think Go doesn't ...
12 years, 2 months ago (2012-11-01 16:46:51 UTC) #42
minux1
On Fri, Nov 2, 2012 at 12:46 AM, Russ Cox <rsc@golang.org> wrote: > Using "Executable" ...
12 years, 2 months ago (2012-11-01 16:55:44 UTC) #43
rsc
If we limit Executable to that smaller scope it sounds like no one wants it ...
12 years, 2 months ago (2012-11-01 17:23:10 UTC) #44
minux1
On Fri, Nov 2, 2012 at 1:23 AM, Russ Cox <rsc@golang.org> wrote: > If we ...
12 years, 2 months ago (2012-11-01 17:26:46 UTC) #45
rsc
The complexity of the implementation needs to be paid for by general utility. I haven't ...
12 years, 2 months ago (2012-11-01 17:30:33 UTC) #46
bradfitz
I would use this in things like gorunas, launching child processes of myself, since we ...
12 years, 2 months ago (2012-11-01 17:35:57 UTC) #47
rsc
If you change the doc comment to // Executable returns a path that can be ...
12 years, 2 months ago (2012-11-01 17:49:57 UTC) #48
r
I'd still prefer to leave it out, for the reasons rsc said. I still believe ...
12 years, 2 months ago (2012-11-01 19:20:40 UTC) #49
minux1
PTAL. On 2012/11/01 17:49:57, rsc wrote: > If you change the doc comment to > ...
12 years, 2 months ago (2012-11-01 20:00:53 UTC) #50
taruti
Why not simply have a (using os/exec): func SelfCommand(arg ...string) (*exec.Cmd, error) If the idea ...
12 years, 2 months ago (2012-11-01 22:14:01 UTC) #51
aram
A very big -1 on this change. The original problem was "how to find assets ...
12 years, 2 months ago (2012-11-02 09:59:53 UTC) #52
minux1
On Fri, Nov 2, 2012 at 5:59 PM, Aram Hăvărneanu <aram@mgk.ro> wrote: > A very ...
12 years, 2 months ago (2012-11-02 12:07:30 UTC) #53
rsc
There is enough disagreement about this that I would like to leave it for a ...
12 years, 2 months ago (2012-11-02 20:20:33 UTC) #54
kardia
Would it be possible to get in a CL just for darwin, and only have ...
12 years, 2 months ago (2012-11-02 20:23:38 UTC) #55
minux1
On Sat, Nov 3, 2012 at 4:20 AM, Russ Cox <rsc@golang.org> wrote: > There is ...
12 years, 2 months ago (2012-11-03 06:15:11 UTC) #56
rsc
Let's leave 4057 as priority-someday. Thanks.
12 years, 1 month ago (2012-11-06 19:35:30 UTC) #57
ality
Removing myself from reviewers.
11 years, 5 months ago (2013-07-20 06:50:57 UTC) #58
rsc
11 years ago (2013-12-18 04:11:02 UTC) #59
R=close
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b