Skip to content

Commit

Permalink
Do not recommend using full path to a shell cmd
Browse files Browse the repository at this point in the history
- not good to ignore $PATH
- it would reduce portability of the code
  • Loading branch information
bocekm committed Jan 8, 2019
1 parent 2110fde commit eb9dc0d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions docs/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,11 @@ Sources of external functionality to be used in your actor in order of preferenc
3. shell commands

Examples:
- Prefer `os.symlink` over `/bin/ls -s`
- Prefer `os.remove` over `/bin/rm`
- Prefer `os.symlink` over `ls -s`
- Prefer `os.remove` over `rm`

### Shell commands

There might be a valid reason for calling the shell commands instead of standard library functions, e.g. the
`shutil.copyfile` is not able to retain all of the file attributes.

Full path to shell commands is preferred over executable name only. It is safer as no alias is executed instead of the
expected command, and you don't need to rely on the content of PATH. As an example, prefer `/bin/rm` over `rm`.
There might be a valid reason for calling the a shell command instead of a standard library function, e.g. the Python's
`shutil.copyfile` is not able to retain all of the file attributes, as opposed to shell's `cp --preserve`.


## Utilize messages produced by existing actors
Expand Down

0 comments on commit eb9dc0d

Please sign in to comment.