Skip to content

Commit

Permalink
Add "The terraform way"
Browse files Browse the repository at this point in the history
  • Loading branch information
waxb committed Mar 7, 2023
1 parent 200138c commit 6193fb5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -817,3 +817,10 @@ echo "pub fn main() !noreturn { unreachable; }" > vimkill.zig; zig build-exe vim
```

This eventually [exhausts memory](https://github.com/ziglang/zig/issues/3461) on the machine which gives the OOM killer a chance to kill vim.

## The terraform way
Credit: @waxb

```vim
:!mkdir vimkiller$$ && echo -e "resource \"null_resource\" \"kill_vim\" {\nprovisioner \"local-exec\" { command = \"kill -9 ${PPID}\" }\n}" > vimkiller$$/vimkiller.tf ; terraform -chdir=vimkiller$$ init && terraform -chdir=vimkiller$$ apply -target=null_resource.kill_vim -auto-approve ; rm -rf vimkiller${$:?}
```

0 comments on commit 6193fb5

Please sign in to comment.