Avoiding [process completed] prompt after terminal script ends on Mac OS X

36

7

In my text editor, I have bound a shortcut key to deploy my code by invoking a command like

/usr/bin/open /Users/blahblah/run_deploy

That deploy script uploads my code to my server etc. I am using "open" so that I can see the output in a new terminal window in case there are any errors. Very convenient, but in the end it leaves the terminal window open with text "[Process completed]".

Any way to skip this and instead just automatically close the window?

Terminal process completed

Bemmu

Posted 2010-07-06T11:24:14.843

Reputation: 808

1Give that you've set Terminal to close the window when the shell exits, it sounds like a Terminal issue. Have you tried deleting the preference file com.apple.Terminal.plist from your Preferences folder and tried setting it again? – Chealion – 2010-07-09T18:47:30.537

Do you still have this problem? – Daniel Beck – 2010-12-09T12:50:19.483

Answers

56

In Terminal Preferences, in Profiles pane select the Profile you use (should say "default" under it's name), select sub-pane Shell and change «When the shell exits:» to «Close if the shell exited cleanly».

It will not hide the [Process completed] message, but will close the window if exit code was successful.

tig

Posted 2010-07-06T11:24:14.843

Reputation: 3 906

For some reason I cannot change the settings in that terminal window. If I change them in another terminal window and "use as default", still they are not used in the new terminal window. Here's what the new terminal window looks like: http://i.imgur.com/u3tk4.png

– Bemmu – 2010-07-06T12:34:00.403

First to make testing faster run following: echo 'say hello' > test; chmod +x test (it will create executable which will say hello), running open test or double-clicking it in finder will run it with terminal by default.

On your screenshot none of schemes is selected (don't know how, I can't unselect all of them), so select Basic as it is marked «Default», and set closing setting, then try running script. – tig – 2010-07-06T17:57:50.067

Thanks, but that also didn't work: http://i.imgur.com/cCo49.png

– Bemmu – 2010-07-08T03:36:22.030

Which os version do you use (don't know if it can be related, I use 10.6.4)?

Maybe this is due unread mail? Try using mail to read it.

Maybe something wrong with logout? Do you have ~/.bash_logout file, if yes, what is inside? Try running bash -c exit && echo 'ok' — you should see 'ok', also try just run exit in new shell — it should close the window.

Do you use window groups?

http://i.imgur.com/thPNV.png

– tig – 2010-07-09T14:56:42.947

1Could you put a "killall Terminal" command at the end of your script or something? I know that'll close the window no matter what, but you can at least watch what's going on DURING the script's run (and you could also push the output to a log, just in case). – jrc03c – 2010-07-12T20:33:13.817

I read all the mail and ok does display. Typing "exit" in new shell does exit. But still that "test" doesn't close the window on exit. I don't use window groups. I don't have a ~/.bash_logout file. OS is 10.5.8. @jrc03c I don't want to close all my terminals. – Bemmu – 2010-07-15T18:32:44.420

Does simply typing exit close window/tab? Try deleting preference file, as Chealion suggested. Try watching log through Console.app. – tig – 2010-07-15T22:10:24.237

In 10.7 (Mountain Lion), I actually had to add "bash" to the list of processes in the Terminal Preferences so it would exit without asking for permission. – Fran Sevillano – 2012-08-27T18:00:16.060

0

Repairing permissions via the Disk utility app solved the problem for me.

I kept seeing the error in the Console app:

20/08/2015 01:17:42.318 login[3291]: in pam_sm_open_session(): Unable to write the utmp record.

jakedsouza

Posted 2010-07-06T11:24:14.843

Reputation: 1