Hacker News new | ask | show | jobs
by sschueller 4228 days ago
Does curl return a partial output if a connection dies?

What if it dies and the last thing it got was "rm - fr /" but not the rest after the / ?

4 comments

Most shell scripts used like this are implemented by defining a function, then calling it - so if it fails downloading, all that happens is a syntax error as the code never actually gets run.
That's a good point. I filed https://github.com/rust-lang/rust/issues/19168 to get it fixed.
Never thought about this, interesting question.

You can try this equivalent, killing the server when it tells you to - https://gist.github.com/aidanhs/e40417381e9aecb87b35. It prints '/', i.e. would remove your root directory if it was an `rm` command.

Won't be doing that again then.

Remember that these days, with GNU rm, you have to pass in `--no-preserve-root` to actually `rm -rf /`. Attempting to remove something in the home directory and getting a `rm -rf /home/username/` would still be pretty bad.
The chance that the connection dies at exactly this moment is negligible compared to the chance that your hard drive dies. Worry about that.