Skip to content

Commit

Permalink
Fixes for windows subsystem for linux (#66)
Browse files Browse the repository at this point in the history
* fix support for wsl
  • Loading branch information
n-pn authored and vladfaust committed May 4, 2019
1 parent 67b2c97 commit 2ee9d66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Crystal.sublime-build
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"selector": "source.crystal",
"quiet": true,
"windows": {
"cmd": ["bash", "-c", "crystal", "run", "--no-color", "$file"]
"cmd": ["wsl", "crystal", "run", "--no-color", "$file_name"]
}
}
4 changes: 4 additions & 0 deletions crystal_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import subprocess
import sys
import re
import os

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

# for Windows Subsystem for Linux
if os.name == "nt": command.insert(0, "wsl")

popen_args = dict(args=command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# Prevent flashing terminal windows
if sys.platform.startswith('win'):
Expand Down

0 comments on commit 2ee9d66

Please sign in to comment.