Skip to content
This repository was archived by the owner on Sep 21, 2024. It is now read-only.

Commit 2666943

Browse files
authored
Merge pull request #19 from BrianHenryIE/patch-1
Automatically restart runtime
2 parents 2a30ad3 + 66ee0b3 commit 2666943

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ Colab notebooks created directly from Google Drive are tailored for Python progr
2121
```swift
2222
!curl "https://raw.githubusercontent.com/philipturner/swift-colab/release/latest/install_swift.sh" --output "install_swift.sh"
2323
!bash "install_swift.sh" "5.6.2" #// Replace 5.6.2 with newest Swift version.
24-
#// After this cell finishes, go to Runtime > Restart runtime.
24+
#// Restart runtime.
25+
import os
26+
os.kill(os.getpid(), 9)
27+
#// Expected warnings:
28+
#// "Unrecognized runtime 'swift'; defaulting to 'python3'".
29+
#// "Your session crashed. Automatically restarting".
30+
#// "Your session restarted after a crash. Diagnosing..."
31+
#// "Your session crashed for an unknown reason.""
2532
```
2633

2734
> Tip: Colab measures how long you keep a notebook open without interacting with it. If you exceed the time limit of Colab's free tier, it may restart in Python mode. That means Swift code executes as if it's Python code. In that situation, repeat the process outlined above to return to Swift mode.

0 commit comments

Comments
 (0)