diff --git a/thefuck/system/unix.py b/thefuck/system/unix.py
index 9ae01cf4..4ea15c8d 100644
--- a/thefuck/system/unix.py
+++ b/thefuck/system/unix.py
@@ -3,7 +3,7 @@ import sys
 import tty
 import termios
 import colorama
-from distutils.spawn import find_executable
+from shutil import which
 from .. import const
 
 init_output = colorama.init
@@ -38,9 +38,9 @@ def get_key():
 
 
 def open_command(arg):
-    if find_executable('xdg-open'):
-        return 'xdg-open ' + arg
-    return 'open ' + arg
+    """ Get a shell command calling the system's generic opener."""
+    cmd = which('xdg-open') or 'open'
+    return cmd + ' ' + arg
 
 
 try:
diff --git a/tox.ini b/tox.ini
index e95f4811..eaf6a40f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
 [tox]
-envlist = py{27,35,36,37,38,39,310,311}
+envlist = py{27,35,36,37,38,39,310,311,312}
 
 [testenv]
 deps = -rrequirements.txt