How to handle Command 'extension.commandName' not found error in VSCode - visual-studio-code

The problem occurs when one of the long running command is forcefully killed by process.kill
After that whenever I try to execute a command it raise Command 'extension.commandName' not found error.
Note: All the commands are properly registered in package.json under contribution>>command. Commands are also included as part of activationEvents. Keybinding also in place for the registered command. I have also checked similar issues like this but that did not cover my scenario.

The way I am handling this right now is by exposing another command that fires workbench.action.reloadWindow. Once the window is reloaded the extension able to handle request again.

Related

run external process in integrated terminal without task

In an extension, I'm trying to implement a TextEditorCommand in response to which the document in the active editor is processed by an external program. I managed to do so by registering a function with the command, within which a Task object is created and executed:
in function activate:
vscode.commands.registerTextEditorCommand('extension.command', process);
in function process(textEditor):
const document = textEditor.document;
const task = new vscode.Task(
{type: ''},
vscode.TaskScope.Workspace,
extensionDisplayName,
extensionName,
new vscode.ProcessExecution(executable, [fileName].concat(args)));
vscode.tasks.executeTask(task);
This works, except that executing a task leads all open documents to be saved, which is unnecessary and may be unwanted; I only need the active editor document to be saved, which I can do myself.
Therefore my question: Is it possible to run an external process in the integrated terminal without a Task?
I checked whether I can execute the ProcessExecution on its own, without passing it to a Task, but that doesn't seem possible.
I also tried to directly create a terminal, but vscode.window.createTerminal does not provide the option to specify an executable, just a shell – though I might simply pretend that my executable is a shell?
Moreover, I already failed at creating any kind of terminal; putting
````typescript
vscode.window.createTerminal(extensionDisplayName);
````
into the `activate` function seems to have no effect whatsoever.
Turns out the transpiler process wasn't running, so my code never made it into the running extension.
I could simply use node's child_process.spawn, but then the process would not be attached to VS Code's integrated terminal.
Update: Specifying an arbitrary executable as the "shell" running in the Terminal works.
However, it seems currently impossible to keep the terminal tab open after the process ended, so a shell or another wrapper is necessary.
But then it's impossible to get the exit status of the actual (wrapped) process, except maybe by having the wrapper write it to the terminal and parsing it's text content... nah, impossible too. Ugh

KDB script keeps crashing

I've been finding recently that my KDB launch script is crashing. I need to restart my computer and then it will run fine. I launch KDB from a CMD prompt and I can't figure out where to look to see what process is running in the background which is causing it to crash. Does anybody know what I should check?
Thanks.
Trying running a blank kdb instance with just:
set QHOME=C:\q
set PATH=%PATH%;c:\q\w32
and then
q -p 1234
(doesn't need to be in a batch script, you should be able to just run those commands in a cmd prompt). If kdb comes up then kdb isn't the problem.
Then try to manually load the startup script to see if the problem is there:
q)system"l C:\\q\\ServerFiles\\server.q"
If this works fine then the problem isn't there. The last place it can be is in the database/directory load, so load that:
q)system"l c:\\q\\files"
If none of these cause an error then something else is affecting your kdb instance, either something running on a timer (check .z.ts) or something is connecting externally
So I did finally discover what the issue was. I had a few instances of KDB that would run via Task Scheduler in the evening and then close. One of the instances wouldn't end and so it was continually running. This would cause KDB to crash since there was already an instance running. The restart would stop the process so it could be run again. I deleted the task scheduler event and recreated it and now the event runs KDB and closes the way it is supposed to. Thanks for all of the help in trying to figure this out!

zlogin usage in Runeck task

As part of rundeck task i'm trying to login to a global zone, use the command zoneadm list and trying to login to each of the local zone [to shut down various apps & to issue reboot] using the command /usr/sbin/zlogin and execute hostname command to ensure it did login to localzone
however this is not working
Is there a better way to do this? Please guide
Make sure that your job is dispatching to your remote node correctly, you can call the command on "Commands" (right panel) pointing to your node (referenced in the "Nodes" textbox) in that way you can discard possible path/user rights issue, take a look at this. Now, zlogin seems an interactive shell, and as you can see, you need to use it in the non-interactive mode.

Customise debugger stop/restart button behavior

I'm using VS Code to write and debug a C++ program binding to libfuse.
Unfortunately, if you kill a libfuse process with SIGKILL, you then have to use sudo umount -f <mountpoint> before you can start the program again. It's a minor nuisance if I have to do this every time I want to stop or restart debugging, especially as I shouldn't have to authenticate to do such a regular task (the sudo is somehow necessary despite the mount occurring as my user).
While I think this is mainly FUSE's fault (it should gracefully recover from a process being ungracefully killed and unmount automatically instead of leaving the directory saying Transport endpoint is not connected), I also think there should be a way to customise VS Code (or any IDE) to run some clean-up when you want to stop debugging.
I've found that entering -exec signal SIGTERM in the Debug Console will gracefully unmount the directory correctly, stop the process and tell VS Code it's no longer debugging (status bar changes back from orange to blue). But I can't seem to find a way to automate this. I've tried using a .gdbinit file, with some inspiration from this question:
handle SIGTERM nostop
# This doesn't work as hook-quit isn't run when quitting via MI mode, which VS Code uses...
define hook-quit
signal SIGTERM
end
But as noted in the linked question, GDB ignores quit hooks when in MI mode, and VS Code uses MI mode.
The ideal solution for me would be if I could put something in a .vscode configuration file telling it to send -exec signal SIGTERM when I click the stop or restart buttons (and then wait for whatever notification it's getting that debugging has stopped, before restarting if applicable) but I imagine there probably isn't an option for that.
Even if the buttons can't be customised, I'd be happy with the ability to have a keybinding that would just send -exec signal SIGTERM to the Debug Console without me having to open said console and enter the command, though the Command Palette doesn't show anything useful here (nothing that looks like it will send a specified Debug Console command), so I don't expect there's a bindable command for that either.
Does anyone have any suggestions? Or would these belong as feature requests over on the VS Code github? Any way to get GDB to respect its quit hook in MI mode, or to get FUSE to gracefully handle its process being killed would be appreciated too.

FileMaker scheduled script not running

I have a scheduled script that used to run just fine, but no longer is. The schedule is running my open script for the database (and completing it) but isn't even making it to the scheduled script that is supposed to get called.
I am testing by adding a "Freeze Window" step, which creates an error in the server log (incompatible with server). When I add it as the last line in the open script, it gets called and an error gets written to the log. When I add it as the first line in my scheduled script, it never gets called and there is no error in the log.
It looks like this:
Server opens database ->
Runs open script for database, to completion ->
Never runs scheduled script after open script
Any ideas or thoughts? Anyone seen anything like this before?
This is FileMaker Server 15 running on Windows Server.
I am starting to think this might be a file reference issue. Not sure if server is able to open up external databases and that might be causing issue?
FMS Scheduled scripts and PSoS can only work with FM files hosted on the same machine.
I am testing by adding a "Freeze Window" step, which creates an error in the server log (incompatible with server). When I add it as the last line in the open script, it gets called and an error gets written to the log. When I add it as the first line in my scheduled script, it never gets called and there is no error in the log.
IIRC, FMS will abort the script at the first incompatible step UNLESS Allow User Abort = OFF.
Note also that a Halt step in a subscript will stop the main script too.