Browse files

Add a fallback when multiprocessing is unsupported

On platforms (Android) where multiprocessing is not supported we now
use threads instead. Fixes #271.
  • Loading branch information...
fornwall authored and sickill committed Apr 8, 2018
1 parent 8c7e3c2 commit 49a892d9e6f57ab3a774c0835fa563c77cf6a7a7
Showing with 10 additions and 1 deletion.
  1. +10 −1 asciinema/asciicast/
@@ -4,7 +4,16 @@
import json.decoder
import time
import codecs
-from multiprocessing import Process, Queue
+ # Importing synchronize is to detect platforms where
+ # multiprocessing does not work (python issue 3770)
+ # and cause an ImportError. Otherwise it will happen
+ # later when trying to use Queue().
+ from multiprocessing import synchronize, Process, Queue
+except ImportError:
+ from threading import Thread as Process
+ from queue import Queue
from asciinema.pty_recorder import PtyRecorder

0 comments on commit 49a892d

Please sign in to comment.