-
Notifications
You must be signed in to change notification settings - Fork 999
add os.StartProcess #4323
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add os.StartProcess #4323
Conversation
33a554e to
e12c2de
Compare
ayang64
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I think this is good but I'd like more context and better comments before we give this a detailed review.
Can you reword some of your comments and maybe add additional commentary to describe some of the compromises you had to make without having to read the code in detail?
Not that I don't want to read the code but comments would help me understand some of the considerations you're talking about.
This is very reasonable, will do that! |
044812d to
33f688d
Compare
|
@leongross please rebase this branch and resolve merge conflicts. Thank you! |
c949f60 to
c5b9207
Compare
c5b9207 to
bcc27db
Compare
|
The CI errors are difficult for me to explain. When I run the test locally I get the following output: |
|
Looks to me like the problem is something to do with needing some additional build tags. The CI builds that fail are Windows and macOS. For example: https://github.com/tinygo-org/tinygo/actions/runs/10061289668/job/27810982068?pr=4323#step:17:32 |
455419f to
cb2f4c3
Compare
3d10773 to
8442180
Compare
|
Internal test dependencies seem to be broken now, although this PR does not change something related to |
4dcef18 to
9f94438
Compare
| fail := int(libc_fork()) | ||
| if fail < 0 { | ||
| // TODO: parse the syscall return codes | ||
| return errors.New("fork failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you can wrap some standard error in here, tests are easier.
syscall.EAGAIN is at least as good as this errors.New I think?
| fail := int(libc_execve(&argv0[0], &argv1[0], &env1[0])) | ||
| if fail < 0 { | ||
| // TODO: parse the syscall return codes | ||
| return errors.New("fork failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. fail can even be
fail := syscall.Errno(libc_execve(&argv0[0], &argv1[0], &env1[0]))
aa6f630 to
2b0cd9e
Compare
|
I suspect that the import errors originate in this syscall package requirement code: |
2b0cd9e to
b4952ad
Compare
Signed-off-by: leongross <[email protected]>
b4952ad to
8ab06b9
Compare
|
Closing since #4377 was merged. |
This PR adds a working implementation for
os.StartProcess, just a concatenation of theforkandexecsyscalls.The upstream Golang implementation has a lot more safeguards with mutices etc but to keep this feasible I think this will do as well.
I would really appreciate some feedback on this to keep this code as bug-free as possible :)