Skip to content

Commit

Permalink
Fix create_shared() to be compatible with other shells (e.g. zsh)
Browse files Browse the repository at this point in the history
Addresses issue #18.

Diagnosis: The command `> log.txt` is intended to create an empty log
named `log.txt`. This command behaves differently for some shells
such as `zsh`. In `zsh`, the command is interpreted as `cat > log.txt`.
(See https://stackoverflow.com/a/15546937 for more details.)

Fix: Use `: > log.txt` to reliably create an empty log.
  • Loading branch information
hcho3 committed Apr 19, 2018
1 parent 731d02c commit b0fd388
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/treelite/contrib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _libext():
return '.so'

def _create_log_cmd_unix(logfile):
return ' > {}'.format(logfile)
return ': > {}'.format(logfile)

def _save_retcode_cmd_unix(logfile):
return 'echo $? >> {}'.format(logfile)
Expand Down

0 comments on commit b0fd388

Please sign in to comment.