3 ms·
This looks fun. I can't imagine it being directly useful but the idea itself is fun. Couple of immediate issues with the repo: - Sample output in the README s
by koolba 6y ago
This looks fun. I can't imagine it being directly useful but the idea itself is fun.
Couple of immediate issues with the repo:
- Sample output in the README should not be prefixed with a "$". That's only for the shell command prompt.
- Use ``` blocks in your README file. It's easier to format multi-line text.
- Don't use $RANDOM, it's not secure. Use mktemp: https://github.com/alcover/runc/blob/73aaecea5a4cd357f7172dd1618d98f0b5b45a01/runc#L122 https://github.com/alcover/runc/blob/73aaecea5a4cd357f7172dd...
- Don't exit with success if the command failed: https://github.com/alcover/runc/blob/73aaecea5a4cd357f7172dd1618d98f0b5b45a01/runc#L131 https://github.com/alcover/runc/blob/73aaecea5a4cd357f7172dd...
- Use Bash strict mode: http://redsymbol.net/articles/unofficial-bash-strict-mode/ http://redsymbol.net/articles/unofficial-bash-strict-mode/
- alcover 6y agoDone, done and done. Thank you ! I need a little time to study your 'strict mode' suggestion. I used 'set -e' before but had problems with it. Would you know how I could detect that input is cat'ed into the script ? ($ cat snippet.c | runc -i). So that I can suppress 'Type your code then CTRL+D'.
- Gaelan 6y ago> Would you know how I could detect that input is cat'ed into the script ? ($ cat snippet.c | runc -i). So that I can suppress 'Type your code then CTRL+D'. Stack Overflow suggests http://stackoverflow.com/questions/10022323/ddg#10022396 http://stackoverflow.com/questions/10022323/ddg#10022396
- alcover 6y agoThank you so much, this is neat.
- city41 6y agoI think this line should use mktemp as well, to be a tad more safe: https://github.com/alcover/runc/blob/master/runc#L109 https://github.com/alcover/runc/blob/master/runc#L109
- tomjakubowski 6y agore: Bash "strict mode", the shell options are fine but resetting IFS blows the weirdness budget for a default. You can get saner splitting for that loop over the array by quoting the array expansion: for name in "${names[@]}" Shellcheck lints that, by the way.