Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

os,runtime: make sure executable path is fully resolved at process init#4881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
dgryski wants to merge1 commit intotinygo-org:dev
base:dev
Choose a base branch
Loading
fromdgryski:dgryski/darwin-executable-path-chdir

Conversation

@dgryski
Copy link
Member

No description provided.

@dgryski
Copy link
MemberAuthor

Not sure I like this solution; it pulls in a bunch of code from syscall to get the cwd at process init.

Copy link
Member

@aykevlaykevl left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This seems like a reasonable solution, even if not perfect (I can't think of a better way right now). Some nits below.


varexecutablePathstring

funcplatform_argv(argcint32,argv*unsafe.Pointer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hmm, I'm not sure I like this name. What aboutstoreExecutablePath or something like that?

Comment on lines +295 to +296
constpathMax=1024
varbuf [4*pathMax]byte
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why use 1024 and then use 4 times that size in the actual buffer? (Also, it would help to give a pointer to why that is the right value, like a link to a man page or something).

ifn<1 {
return""
}
returnstring(buf[:n])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You could consider usingunsafe.String here to avoid an allocation. It should be safe, sincebuf is never modified afterwards. (The potential downside is thatexecutablePath will then always be 4kB in size - not sure whether that's a good tradeoff).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@aykevlaykevlaykevl left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@dgryski@aykevl

[8]ページ先頭

©2009-2025 Movatter.jp