forked from onepub-dev/dcli
-
Notifications
You must be signed in to change notification settings - Fork 0
Implement native_synchronization within dcli/dcli/lib/src/process/process #1
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,9 +7,12 @@ import 'dart:convert'; | |
| import 'dart:isolate'; | ||
| import 'dart:typed_data'; | ||
|
|
||
| import 'mailbox.dart'; | ||
| import 'package:native_synchronization/mailbox.dart'; | ||
|
|
||
| import 'message.dart'; | ||
| import 'process_sync.dart'; | ||
| // import 'mailbox.dart'; | ||
| import 'pipe_sync.dart'; | ||
| // import 'process_sync.dart'; | ||
|
|
||
| /// Send and Receive data to/from a process | ||
| /// running in an isolate using a pair of mailboxes. | ||
|
|
@@ -82,12 +85,12 @@ class ProcessChannel { | |
| late final StringConversionSink splitter; | ||
| late final ByteConversionSink decoder; | ||
|
|
||
| // TODO: this probably need to be int arrays so | ||
| // TODO DONE?: this probably need to be int arrays so | ||
| // we can handly binary data. | ||
| final List<List<int>> stdoutLines = <List<int>>[]; | ||
| final List<List<int>> stderrLines = <List<int>>[]; | ||
| int get sendAddress => send.rawAddress; | ||
| int get responseAddress => response.rawAddress; | ||
| // int get sendAddress => send.rawAddress; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are no longer necessary. |
||
| // int get responseAddress => response.rawAddress; | ||
|
|
||
| int? _exitCode; | ||
| int? get exitCode => _exitCode; | ||
|
|
@@ -147,18 +150,17 @@ class ProcessChannel { | |
|
|
||
| /// check the data has been sent to the spawned process | ||
| /// before we return | ||
| final response = send.takeOneMessage(); | ||
| final response = send.take(); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| if (response.isEmpty || response[0] != RECEIVED) { | ||
| throw ProcessSyncException( | ||
| 'Expecting a write confirmation: got $response'); | ||
| throw ProcessSyncException('Expecting a write confirmation: got $response'); | ||
| } | ||
| } | ||
|
|
||
| void _fetch() { | ||
| Uint8List bytes; | ||
|
|
||
| /// drain the mailbox | ||
| bytes = response.takeOneMessage(); | ||
| bytes = response.take(); | ||
| _recieveFromIsolate(bytes); | ||
| // decoder.add(bytes); | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Seemed like an used import so I commented it out for now.