26

I'm having problems about how to exit the swift-language's terminal mode. I type swift in terminal on my Mac Air (Yosemite), And I got to swift's terminal mode,, something similar to python's.

But in python i can use quit() to exit that mode. However, in swift,, I didn't find such a method..

So I exit the whole terminal by 'command + q'..

Then, I got gabbage like these:

      20282   0.0  0.0        0      0   ??  Z     8:14PM   0:00.00 (repl_swift)
      20372   0.0  0.0  2441988    652 s000  S+    8:30PM   0:00.00 grep swift
      20168   0.0  0.0        0      0   ??  Z     8:00PM   0:00.00 (repl_swift)

What's worse,,, even kill -9 can't kill the repl_swift process.

I guess the only thing I can do is reboot now.. But really curious why~~ Is the swift-terminal mode still in beta version? :)

1
  • 2
    Why can't we control-c like everything else?
    – teradyl
    May 23, 2019 at 1:07

2 Answers 2

80

Type control-d to exit REPL.

control-d is the end of file character and it's used by various command line tools to mark the end of user input.


Added by a later editor

You can also quit the Swift REPL by typing :quit, :q, or :exit

11

You can also type :exit, :quit, or :q at the Swift REPL prompt instead of control-d. Type :help at the Swift REPL for all available commands.

enter image description here

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.