randy3k / Terminus

Bring a real terminal to Sublime Text
https://packagecontrol.io/packages/Terminus
MIT License
1.39k stars 82 forks source link

Migrating build system to Terminus doesn't work #330

Open hovsater opened 2 years ago

hovsater commented 2 years ago

I'm on macOS, version 12.0.1, running Sublime Text, build 4125. I have the following build system defined in my project.

{
    "build_systems": [
        {
            "name": "Run",
            "selector": "source.odin",
            "cmd": ["odin", "run", "$file"],
            "env": {
                "PATH": "/Users/kevinsjoberg/code/Odin:$PATH"
            },
            "variants": [
                { "name": "Run tests", "cmd": ["odin", "test", "$file"] }
            ],
        },
    ]
}

and it works great. I tried to migrate this to Terminus by changing my setup to the following instead.

{
    "build_systems": [
        {
            "name": "Run",
            "selector": "source.odin",
            "cmd": ["odin", "run", "$file"],
            "target": "terminus_exec",
            "cancel": "terminus_cancel_build",
            "env": {
                "PATH": "/Users/kevinsjoberg/code/Odin:$PATH"
            },
            "variants": [
                { "name": "Run tests", "cmd": ["odin", "test", "$file"] }
            ],
        },
    ],
}

but it doesn't work. Upon running with this new configuration, I'm greeted with a blank pane. See image below.

Screenshot 2021-12-20 at 10 15 28

and the Sublime console spits out the following information:

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1496, in run_
    self.view.end_edit(edit)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime.py", line 1297, in end_edit
    sublime_api.view_end_edit(self.view_id, edit.edit_token)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 924, in on_modified
    run_view_callbacks('on_modified', view_id)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 708, in run_view_callbacks
    callback(v, *args)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 152, in profiler
    return event_handler(*args)
  File "/Users/kevinsjoberg/Library/Application Support/Sublime Text/Installed Packages/Terminus.sublime-package/terminus/commands.py", line 39, in on_modified
    if not terminal or not terminal.process.isalive():
AttributeError: 'Terminal' object has no attribute 'process'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1496, in run_
    self.view.end_edit(edit)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime.py", line 1297, in end_edit
    sublime_api.view_end_edit(self.view_id, edit.edit_token)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 932, in on_selection_modified
    run_view_callbacks('on_selection_modified', view_id)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 708, in run_view_callbacks
    callback(v, *args)
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 152, in profiler
    return event_handler(*args)
  File "/Users/kevinsjoberg/Library/Application Support/Sublime Text/Installed Packages/Terminus.sublime-package/terminus/commands.py", line 60, in on_selection_modified
    if not terminal or not terminal.process.isalive():
AttributeError: 'Terminal' object has no attribute 'process'
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/Lib/python33/sublime_plugin.py", line 1488, in run_
    return self.run(edit, **args)
  File "/Users/kevinsjoberg/Library/Application Support/Sublime Text/Installed Packages/Terminus.sublime-package/terminus/commands.py", line 696, in run
  File "/Users/kevinsjoberg/Library/Application Support/Sublime Text/Installed Packages/Terminus.sublime-package/terminus/terminal.py", line 226, in activate
  File "/Users/kevinsjoberg/Library/Application Support/Sublime Text/Packages/ptyprocess/all/ptyprocess/ptyprocess.py", line 210, in spawn
    'executable: %s.' % command)
FileNotFoundError: The command was not found or was not executable: odin.
Exception AttributeError: "'Terminal' object has no attribute 'process'" in <bound method Terminal.__del__ of <Terminus.terminus.terminal.Terminal object at 0x7f83088054d0>> ignored
g-regor commented 2 years ago

Same, but on Windows.

The build system with the default config works. Also I can open Terminus in a tab. But just adding

"target": "terminus_exec",
"cancel": "terminus_cancel_build",

to the build system config and running the build, throws

Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 1488, in run_
    return self.run(edit, **args)
  File "C:\Users\grego\AppData\Roaming\Sublime Text 3\Installed Packages\Terminus.sublime-package\terminus/commands.py", line 523, in run
  File "C:\Users\grego\AppData\Roaming\Sublime Text 3\Installed Packages\Terminus.sublime-package\terminus/terminal.py", line 74, in cull_terminals
  File "C:\Users\grego\AppData\Roaming\Sublime Text 3\Installed Packages\Terminus.sublime-package\terminus/terminal.py", line 244, in kill
AttributeError: 'Terminal' object has no attribute 'process'
tomeksowi commented 2 years ago

Same here, can open Terminus tab, build fails. macOS 12.6, Sublime Build 4126.

My config in .sublime-project file (works as expected with "target" and "cancel" commented out):

"build_systems":
[
{
    "name": "Clang single file color",
    "working_dir": "${project_path}",
    "cmd": ["clang", "-fdiagnostics-color=always",  "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    // "quiet": true,
    "target": "terminus_exec",
    "cancel": "terminus_cancel_build",
}
]

Console output on build:

kill
Traceback (most recent call last):
  File "/Users/toms/Library/Application Support/Sublime Text/Installed Packages/Terminus.sublime-package/terminus/commands.py", line 29, in <lambda>
  File "/Users/toms/Library/Application Support/Sublime Text/Installed Packages/Terminus.sublime-package/terminus/commands.py", line 192, in run_async
  File "/Users/toms/Library/Application Support/Sublime Text/Installed Packages/Terminus.sublime-package/terminus/terminal.py", line 244, in kill
AttributeError: 'Terminal' object has no attribute 'process'