app.exec() - run system shell command #15
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.
Ability to execute system commands and shell scripts from androidjs app. There are quite a lot of handy utilities in android system like
am, toybox, sh, setprop, getprop, logcat
which can be use for backend processing leaving nodejs for more advanced tasks. Linux/ shell powerusers can accomplish quite a bit of using these.Examples of usage:
To chain commands, to use output redirections and other advanced stuff use shell:
Commands are executed in blocking synchronous manner so to process some longer lasting tasks use shell background processing. To check if background task completed and to get results
setInterval()
method could be used:It could be also accomplished in more reactive manner realizing http server using shell and netcat (
toybox nc
) on backend side and regular xhr requests on frontend side. For an example and as a starting point see: https://github.com/AdamDanischewski/bashttpdSome notes on it:
toybox
equivalentsHere is a demo app to test
app.exec()
API: myapp-202012101200.zipFor more see also:
[Related android-js/androidjs#60, Fix android-js/androidjs#153] i