-
-
Notifications
You must be signed in to change notification settings - Fork 203
child process - sanity tests and tweaks #392
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
child process - sanity tests and tweaks #392
Conversation
I really like where this is going! |
I've checked the argument order of existing existing API's for consistency. The only component I found that refers to a runtime object on the electron process is Window::resize(400, 300, 'settings'); The order of arguments is mirrored to what we use for the ChildProcess. ChildProcess::start('alias-for-child', 'sleep 10s'); Flipping those two arguments would be more consistent. And, now I think about it a bit more, the actual command also feels like the more important argument of the two. Another option to consider is to use a fluent API instead. Most other components do something like the example below: Dialog::new()
->title('Select a file')
->open(); Something similar could be achieved with ChildProcess, like we did with the proc_open experiment. But this may be overkill for this scenario. The operations on a process before and after starting it is quite limited. $loop = ChildProcess::alias('main-loop')
->persistent()
->artisan('main-loop:start')
->message('send to stdin'); // race condition / nonsensical use-case?
My gut tells me to go with flipping the arguments. What do you think @simonhamp? |
I can add the option to make a process restart when it exits somewhere here. Do you already have something for this on the electron side @simonhamp? |
Yep let's flip the args 👍🏼
Yes I do. I think we should let the Electron side handle this for now |
I think that's it. Need to do some testing tonight to make sure this integrates with the Will mark this as ready for review |
If this is okay like this I'll start writing some documentation next |
Definitely! I've made a start on the docs here: NativePHP/nativephp.com#53 |
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.
these are great improvements. I think it just needs a little more to take it to the next level
9a50f74
to
8dbee1d
Compare
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.
This is looking excellent
Builds on #389
I started adding some tests. Will add some extra things to the ChildProcess api if that's okay with you @simonhamp.
cwd
default if none was givenChildProcess::artisan()
convenience methodcmd
argument accepts either a string or a array