Sublime Forum

Bug: No Build System

#1

I created my own "build system"in both windows and linux.
The following only works in windows. I believe there is a bug. I’m on build 3083

{
“cmd”: [“ls”, “$file”, “$file_base_name”]
,“shell”: true
,“working_dir”: “${project_path:${folder}}”
,“selector”: “source.js”
}

0 Likes

#2

"shell": true doesn’t do anything. If you want run command via shell you need to use shell_cmd instead of cmd:

"shell_cmd": "ls $file $file_base_name"
0 Likes

#3

It does, actually. "shell": true in combination with the "cmd" key was the ST2 way of invoking commands on the command shell/cmd on Windows and is still supported in ST3.
That said, "shell_cmd" is better and should be used on ST3. Note that it needs to be a string and that you need to enquote paths yourself.

0 Likes

#4

What I am saying is that in windows I can get this to work, in linux I cannot. In fact I have tried a variety of cmd and shell_cmd with and without shell = true.

The exact same thing(s) in Linux does not work. I can’t get a simple ls command working. I have also tried a executing a script that would set a flag just in case the output is not captured. I have tried every combination of cmd, shell_cmd, shell=true/false. The only variable that matters is the Operating system.

Is there a way to debug what is happening before the error “No Build System” is returned. Perhaps it is a permission problem? Dependency on some python module?

0 Likes

#5

Are you sure you’re placing the file in the right place? Run this in Sublime’s console to find a path to packages’ directory:

window.extract_variables()["packages"]

If it is the place try this:

sublime.load_resource("Packages/<your_package>/<your_build>.sublime-build")

It will show you if Sublime can at least access the file.

0 Likes

#6

Thanks so much, I am seeing this error:
>>> sublime.load_resource("/home/myuser/.config/sublime-text-3/Packages/User/Node.sublime-build")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/opt/sublime_text_3/sublime.py", line 140, in load_resource
raise IOError("resource not found")
`OSError: resource not found``

The first line does return what I expected
>>> window.extract_variables()["packages"] '/home/myuser/.config/sublime-text-3/Packages'

I also tried this:
>>> import sublime_api
>>> sublime_api.load_resource("/home/myuser/.config/sublime-text-3/Packages/User/Node.sublime-build")
which just returns nothing, but does not throw an error

The file does exist, I copied the path from the command line. I don’t see any weird premissions issues with the python files. :confused: Any other ideas?

0 Likes

#7

The “Packages” part in the path to load_resource needs to be literal. Load_resource is relative to the Data directory.

0 Likes

#8

Pasting this into a file does make a build-system which Sublime refuses to load. Running

sublime.load_resource("Packages/User/Node.sublime-build")

gives us

'{\n"cmd": ["ls", "$file", "$file_base_name"]\n,"shell": true\n,"working_dir": "${project_path:${folder}}"\n,"selector": "source.js"\n}\ufeff\n'

The interesting part is in the end: "source.js"\n}\ufeff\n'. You can see a unicode character near the bracket. Seems like it breaks json parser. Removing it makes build-system visible.

0 Likes

#9

Ha! that did it. Thank you so much for talking time to help me sort this out. I created the file with Sublime… also I tried deleting everything after the last } (put the cursor after the } and Shift + Ctrl + End, Delete. Which didn’t work. I also tried closing the flie and reopening it and then saving it again to see if these characters reappeared - they do not. I also created a new build file (using sublime to regenerate this file) thus trying to regenerate this error - that also didn’t cause the problem. I swear I didn’t put them here… so I’m not sure how this whole bug got started. I don’t see how you caught it either for that matter - did they survive copying and pasting through the the forums and email?? Weird. Thanks again!!!

0 Likes