# Catching "File Saved" or CMD-W Signal?

**URL:** <https://www.ruby-forum.com/t/catching-file-saved-or-cmd-w-signal/175765>\
**Category:** Ruby\
**Created:** [September 19, 2009, 5:04am UTC](https://www.ruby-forum.com/t/catching-file-saved-or-cmd-w-signal/175765 "2009-09-19T05:04:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![viatropos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/8baadc/32.png) [@viatropos](https://www.ruby-forum.com/u/viatropos)\
**Post date:** [September 19, 2009, 5:04am UTC](https://www.ruby-forum.com/t/catching-file-saved-or-cmd-w-signal/175765/1 "2009-09-19T05:04:24Z")

</div>

Hey,

How does git/svn know to to finish committing your changes after you  
close the commit message (assuming you open it in TextMate or  
something)?

I would like to create something similar, where you run a command, it  
opens a file for you to fill in the blanks, and when you save and close  
it, the process finishes, how would I do that?

Thanks so much,  
Lance

---

<div class="post-metadata">

**Author:** ![viatropos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/8baadc/32.png) [@viatropos](https://www.ruby-forum.com/u/viatropos)\
**Post date:** [September 19, 2009, 5:23am UTC](https://www.ruby-forum.com/t/catching-file-saved-or-cmd-w-signal/175765/2 "2009-09-19T05:23:18Z")

</div>

It spawns the child process (editor) and when it quits it checks the  
status code of the process. If it was successful it continues with the  
commit.

---

<div class="post-metadata">

**Author:** ![viatropos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/8baadc/32.png) [@viatropos](https://www.ruby-forum.com/u/viatropos)\
**Post date:** [September 19, 2009, 7:51am UTC](https://www.ruby-forum.com/t/catching-file-saved-or-cmd-w-signal/175765/3 "2009-09-19T07:51:01Z")

</div>

> It spawns the child process (editor) and when it quits it checks the  
> status code of the process. If it was successful it continues with the  
> commit.

Thanks, that’s how it works!

Anyone have a quick snippet to make that happen? How does it know when  
it quits, and how does it continue the process, that seems like I’d need  
to look through a lot of blogs 😛

Thanks,  
Lance
