I just want to highlight an easy mistake to make here. One might expect to
be able to run something like this:

exec.Command("echo", "-n", "123456", "|", "dmtxwrite", "-s", "16x48", "-o",
"image.png")

But, as you might have found, this doesn't work. This is because the pipe
"|" is an operator implemented by shells like sh and bash. As mentioned in
the overview of the os/exec package, the package never invokes your shell
automatically, so operators like the pipe operator are not available by
default. Jan's answer works because it invokes the shell explicitly to run
your command.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAA%3DXfu0YtHNT01vV1JxvpaORfaBCNMLdSYz2LBVpZZHXwNBt3Q%40mail.gmail.com.

Reply via email to