Owl.System (Owl v0.1.0) View Source

An alternative to some System functions.

Link to this section Summary

Functions

A wrapper around System.cmd/3 which additionally logs executed command and args.

Link to this section Functions

Link to this function

cmd(command, args, opts \\ [])

View Source

Specs

cmd(
  binary(),
  [binary()],
  keyword()
) :: {Collectable.t(), exit_status :: non_neg_integer()}

A wrapper around System.cmd/3 which additionally logs executed command and args.

If URL is found in logged message, then password in it is masked with asterisks.

Examples

> Owl.System.cmd("echo", ["test"])
# 10:25:34.252 [debug] $ echo test
{"test\n", 0}

> Owl.System.cmd("psql", ["postgresql://postgres:postgres@127.0.0.1:5432", "-tAc", "SELECT 1;"])
# 10:25:50.947 [debug] $ psql postgresql://postgres:********@127.0.0.1:5432 -tAc 'SELECT 1;'
{"1\n", 0}