Comments (3)
with cmd it only works, because with the MuonTrap it doesn't?
iex(3)> cmd("echo hello")
hello
0
from muontrap.
iex(1)> System.cmd("echo", ["hello"])
** (ErlangError) Erlang error: :enoent
(elixir 1.12.3) lib/system.ex:1041: System.cmd("echo", ["hello"], [])
from muontrap.
Nerves has a very limited set of Linux utilities available. You found an interesting case where echo
is not available. However, it's possible to still use echo
as a built-in shell command.
To see what's available, run ls
on /bin
and /usr/bin
. Here's what I get:
iex(1)> ls "/bin"
ash busybox cat cp date dd df
dmesg grep kill ls mkdir mknod mktemp
mount mv pidof ping ping6 ps pwd
rm rmdir sed sh sleep touch umount
The cmd/1
function runs whatever you pass it in a shell via sh -c
. You can do the same thing with System.cmd/3
and MuonTrap.cmd/3
:
iex(4)> System.cmd("echo", ["hello"])
** (ErlangError) Erlang error: :enoent
(elixir 1.14.1) lib/system.ex:1060: System.cmd("echo", ["hello"], [])
iex:4: (file)
iex(4)> System.cmd("sh", ["-c", "echo hello"])
{"hello\n", 0}
from muontrap.
Related Issues (13)
- Attempt to convert args to binaries HOT 3
- Windows support. HOT 4
- Fails to compile when there's a space somewhere in the absolute path HOT 4
- Delay to sigkill HOT 2
- Establishing/Supervising Communications With a Long-Running, Data Streaming Python Process HOT 3
- Muontrap.Daemon Proposal HOT 8
- Escript Troubles HOT 8
- Log stderr when running a daemon
- cgroup support no longer working on Linux 5.15
- Compiler error on Ubuntu 20.04
- Add test to verify killing chatty processes
- Support new/updated logger levels
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muontrap.