Skip to content

Commit 2ee9d66

Browse files
n-pnvladfaust
authored andcommitted
Fixes for windows subsystem for linux (#66)
* fix support for wsl
1 parent 67b2c97 commit 2ee9d66

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

Crystal.sublime-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"selector": "source.crystal",
55
"quiet": true,
66
"windows": {
7-
"cmd": ["bash", "-c", "crystal", "run", "--no-color", "$file"]
7+
"cmd": ["wsl", "crystal", "run", "--no-color", "$file_name"]
88
}
99
}

crystal_format.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import subprocess
33
import sys
44
import re
5+
import os
56

67
import sublime_plugin
78
import sublime
@@ -33,6 +34,9 @@ def run(self, edit):
3334
#command = [settings.get("crystal_cmd"), "tool", "format", "-", "--format", "json"]
3435
command = [settings.get("crystal_cmd"), "tool", "format", "-", "--no-color"]
3536

37+
# for Windows Subsystem for Linux
38+
if os.name == "nt": command.insert(0, "wsl")
39+
3640
popen_args = dict(args=command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
3741
# Prevent flashing terminal windows
3842
if sys.platform.startswith('win'):

0 commit comments

Comments
 (0)