News for hackers. Stuff that matters.
Re:Heroku Fucking Console by flurie on Friday March 01, 2013 @11:39AM (#5305236)

  Use exit() or Ctrl-D (i.e. EOF) to exit
Gets me more often than I'd like to admit.
Re:Heroku Fucking Console by eurleif on Friday March 01, 2013 @11:50AM (#5305319)
That message is generated by the __repr__() method, so it could get inadvertently triggered if it just exited automatically.
Re:Heroku Fucking Console by fps on Friday March 01, 2013 @03:03PM (#5306618)
Use "logout" to leave the shell.

Thanks, tcsh. Now I remember why I don't use you.

Re:Heroku Fucking Console by tomsthumb on Friday March 01, 2013 @04:23PM (#5307024)
Why don't you just alias exit?
Re:Heroku Fucking Console by jaytaylor on Friday March 01, 2013 @05:59PM (#5307516)
Because that's a B.S. thing to have to do. Should the whole community of users of that piece software have to alias that command?
Re:Heroku Fucking Console by pjscott on Friday March 01, 2013 @11:28PM (#5308461)
Another reason to switch to IPython: if you type "exit", it will just exit.

http://ipython.org/

Re:Heroku Fucking Console by Stratoscope on Saturday March 02, 2013 @02:08PM (#5310597)
Even worse, on Windows the message is:

  Use exit() or Ctrl-Z plus Return to exit
Well, first, there is no Return key on any PC keyboard I've seen in a very long time. There is an Enter key.

But that's minor. The bad part is if I'm used to Linux and try to exit on Windows with Ctrl+D, I get this cryptic message:

  >>> ^D
    File "<stdin>", line 1
      ♦
      ^
  SyntaxError: invalid syntax
  >>>
Suppose it's the other way around: I started out as a Windows user and got accustomed to using Ctrl+Z to exit.

Now what happens if I switch to Linux (as an inexperienced Linux user) and try to use Ctrl+Z to exit? Yes, I get this somewhat cryptic message:

  >>> 
  [1]+  Stopped                 python
  mike@s:~$
Now, you know that I haven't exited Python at all but have merely backgrounded it, but remember I'm an inexperienced Linux user and don't know about fg and bg and stuff like that yet. So every time I "exit" from Python I've added another background task. Oops.
Re:Heroku Fucking Console by moolcool on Friday March 01, 2013 @11:45AM (#5305286)
Is there any reason you can't ctrl-c out of man pages?
Re:Heroku Fucking Console by byroot on Friday March 01, 2013 @12:01PM (#5305409)
Because it use less as default pager and less is an interactive utility.

If you prefer you can use another pager like more that will let you ctrl-c:

  export PAGER=more
Or activate the -K option of less that will quit on ctrl+c

  export PAGER='less -K'
Re:Heroku Fucking Console by nailer on Friday March 01, 2013 @02:03PM (#5306215)
Why can't interactive utilities be cancelled?
Re:Heroku Fucking Console by azernik on Friday March 01, 2013 @02:16PM (#5306314)
They can be cancelled, just not with CTRL+C - that key combo sends SIGINT [1] to the process, which can be caught by a handler, and often is when the writer of the utility thought there was something else that users would want that signal to do instead of quit. For example, in less, SIGINT will stop a long-running text search that's taking too much time.

[1] http://en.wikipedia.org/wiki/SIGINT_%28POSIX%29#SIGINT

Re:Heroku Fucking Console by Karunamon on Friday March 01, 2013 @02:21PM (#5306350)
Wouldn't this mean that the application has some concept of state, then? Following output, running a search, etc?

If your state is just sitting in the file, interpret the signal as exit.

Re:Heroku Fucking Console by jlgreco on Friday March 01, 2013 @04:18PM (#5306996)
It is possible, though arguably it wouldn't necessarily be the best user experience. At least I know I have the habit of smacking ctrl-c several times in a row when something isn't responding as rapidly as I like. Things like ctrl-c probably should not be stateful if one of the potential things it can do is close your program.

As another example, perhaps it would be nice if ctrl-w deleted one word backwards if you were currently editing text in your webbrowser, but close your current tab/window otherwise. If the state is always what the user expects when they press ctrl-w it would work fine, but in reality you would have lots of people accidentally closing tabs.

Re:Heroku Fucking Console by nailer on Sunday March 03, 2013 @01:10PM (#5314585)
SIGINT in less wouldn't lose work though. It's safe and would be consistent with other apps and other uses of SIGINT inside less.
Re:Heroku Fucking Console by tjoff on Friday March 01, 2013 @04:14PM (#5306986)
So if the search finished just before issue ctrl+c you will close the application instead. Be vary of inconsistencies, even if they are just perceived inconsistencies.
Re:Heroku Fucking Console by raylu on Friday March 01, 2013 @04:08PM (#5306960)
It would be pretty annoying if I ran a search or a follow (shift+F), thought it was taking too long, and hit Ctrl+C right after it finished.

Ctrl+C doesn't mean "end this program." If you want that, consider Ctrl+\.

Re:Heroku Fucking Console by nitrogen on Friday March 01, 2013 @04:55PM (#5307183)
Even Ctrl+\ (SIGQUIT) doesn't always "end this program." Java uses it to print a stack trace to the console.
Re:Heroku Fucking Console by LeonidasXIV on Friday March 01, 2013 @08:42PM (#5308079)
Most Java programs I have to deal with print stack traces to the console even without prompting because somebody thought that the `ex.printStackTrace();` IDE autofix is definitely more than enough to handle an exception.
Re:Heroku Fucking Console by pygy_ on Friday March 01, 2013 @11:52AM (#5305344)
I think that man uses 'less' as a pager, and 'less' uses vi-like key bindings.

It enables you to search using '/keyword', for example.

Re:Heroku Fucking Console by trumbitta2 on Friday March 01, 2013 @01:26PM (#5305972)
That's because vi uses less as a pager, too :)
Re:Heroku Fucking Console by huhsamovar on Friday March 01, 2013 @05:03PM (#5307233)
If you press 'q', the man page will close.
Re:Heroku Fucking Console by maccard on Saturday March 02, 2013 @10:39AM (#5309769)
that's great. but why doesn't ctrl c do it? I mean it closes everything else on my system, except man pages, vim and some other programs that use less.