Every other time I debug in VSCode on windows, it fails - windows

See the following two commands. This is what I see in the VSCode integrated terminal when I try to debug myfile.py. The first time I go to debug it, it works fine, but the second time it looks like the command gets garbled somehow and it fails. When I go to try again, it starts up a new terminal and the cycle repeats.
$ cmd /C "C:\Users\...\python.exe c:\Users\...\.vscode\...\debugpy\launcher 59863 -- c:\Users\...\myfile.py "
<debug output>
$ c: && cd c:\Users\..\mydir && cmd /C "C:\Users\...\python.exe c:\Users\...\.vscode\...\debugpy\launcher 59876 -- c:\Users\...\myfile.py "
bash: c:: command not found
I've tried changing my launch.json to "internalConsole" instead of "integratedTerminal" and I tried to add "args": ["&&", "exit"], but oddly there was no change, even though I'm confident I'm using the right launch.json.
How do I get this to work reliably?
For reference, this is on Windows and I'm using MSYS2 as my shell.

Related

How to execute a long CURL command on zsh on mac terminal?

Trying to run a curl command on macos terminal which I was able to run from a windows command prompt. The curl command is relatively long with multiple "--data-urlencode" flags (5 total) and then the final -v flag. On windows, I can simply copy/paste the command to the command prompt or powershell, press Enter, and it runs fine. However, on macos terminal using zsh, the command prompt just shows a reverse prompt after I try to press Enter. It's as if it is waiting for more input or some other run command which I am not aware of.
On macos, I have been able to run shorter curl commands without any issues, but when I paste in a relatively longer curl command, I am presented with more prompts as if zsh doesn't realize the command input is done. I have also tried to manually type out the command to see if copy/paste is the issue, but same problem. I have also tried to change the order of the flag options, but that doesn't make any difference either. I have googled the heck out of this, but alas - no joy.

WebStorm: bash script errors when run with "run", but works when executed in the console

I wrote a build script for my project (maven, grunt as well as some server-reconfiguration), and when I use the WebStorm command-line with
~/Projects/javaee-angularjs$ ./launchServer.sh
Everything works as expected.
However, when I configure the file to be run by WebStorm (the green triangle top-right) it fails because of: /home/user/Projects/javaee-angularjs/launchServer.sh: line 29: grunt: command not found
The run-config should be absolutely correct:
working directory is the correct one and the script is found to begin with.
Any Idea what could cause this weird behavior?
P.S. I don't know whether WebStorm can run bash natively, since I've always had the bash plugin installed.
Try starting WebStorm from terminal - does the issue persist?
When being launched from desktop/System menu, WebStorm only sees environment variables configured in ~/.profile (login shell), but not in interactive shell configuration files (like ~/.bashhrc). Possible workarounds:
Workaround 1: make required variables available in a login shell (i.e. for bash, move them from .bashrc to .bash_profile).
Workaround 2: run IDE from a terminal, via bin/webstorm.sh
Workaround 3: edit the desktop launcher and set command to /bin/bash -l -i -c "/path/to/webstorm.sh"
see also https://youtrack.jetbrains.com/issue/IDEABKL-7589
The error sounds like Webstorm cannot find grun in its path. Try using the full path to the grunt command.

How do you make Execute do anything in Geany?

I am trying out Geany for the first time. Compile and Build work fine (and indeed the commands are automatically detected), however I have been unable to make Execute do anything at all.
My setup:
Create a new project
Save a basic C hello world as hello-world.c
(I am using Kubutuntu 14.04.)
With no extra setup, pressing F9 or clicking Build -> Build correctly builds the executable. However, when I press F5 or click Build -> Execute, a terminal window appears with a $ prompt, and nothing else.
I have tried going to Build -> Set Build Commands and changing the command next to Execute to various things, including "echo hi there", but the result is always the same: a $ prompt, and nothing else.
How do I make F5 do anything?
Update: I have created VMs with clean installs of Ubuntu 14.04 and Kubuntu 14.04. Geany on Ubuntu works as expected, and F5 runs the program. On Kubuntu, I get the same issue I get on my laptop running Kubuntu 14.04. So it seems this is a Kubuntu specific problem.
Solution
In Edit -> Preferences -> Tools, change the Terminal from
x-terminal-emulator -e "/bin/sh %c"
to
x-terminal-emulator -e /bin/sh %c
Explanation
When you press Execute, Geany executes the terminal specified in Edit -> Preferences -> Tools, replacing %c with the Execute command set in Build -> Set Build Commands.
In Ubuntu, the default terminal emulator supports -e being passed a single parameter in quotes which contains an entire command line, and Execute works as expected. However, the default terminal emulator in Kubuntu is Konsole, which does not support this; it only supports using the rest of arguments after -e as a command line. When KDE attempted to implement it, this bug was introduced so they reverted the change.
Update
Konsole will support the terminal emulator parameters that Geany uses by default from KDE 4.14.2, so once that's out, this workaround will no longer be needed.
This solution also works in Lubuntu 17.04.
In Geany
Edit -> Preferences -> Tools, change the Terminal from
x-terminal-emulator -e "/bin/sh %c"
to
x-terminal-emulator -e /bin/sh %c

Running shell commands from Xcode breakpoint

I'm trying to run a shell script from a breakpoint in Xcode 4.5 DP 3. I set the breakpoint as such using the Choose button.
However, upon hitting the breakpoint I get the following message:
Error in shell command for breakpoint "(selector name)". The command "/Users/Max/Developer/saveToLog.sh" does not exist.
I've tried to put regular shell commands, like "say test" but Xcode prints the same message (with a different command name, of course). The shell script works fine when I run it from terminal.
Ok, first check to make sure you have the shell permissions set correctly. In terminal type:
chmod u+x saveToLog.sh
And I would also locate the shell script inside the project folder (didn't seem to work correctly for me when the script was located on my desktop).
This is the script I tested on:
#!/bin/bash
touch ~/Desktop/ItWorks.txt
echo "This actually works!" > ~/Desktop/ItWorks.txt

How do you run a command in iTerm when it launches?

I'm working on configuring the iTerm terminal emulator for the Mac to do what I want. Apparently everything is done through what they call "bookmarks." OK, fine. I'm trying to create a bookmark that will open a tab, cd to a certain Rails project, and run the command script/server. What's supposed to happen is that this will launch the server daemon ("Mongrel") and I'll see the output scrolling by every time I look at that tab.
In the config dialog, under "command" I put script/server and under "working dir" I put the project directory.
What happens is that the tab appears for 1/10th of a second then vanishes.
Recalling a similar problem I had with the Unix screen command, I tried putting a "command" of bash -c 'script/server' but the result was identical.
You're running into that problem because your script runs and then terminates. All you need to do is put a read or something equally sophisticated to say "Press any key to complete script and close window...." at the end of the script.
update
I wrote this test script:
$ cat echoscript
#!/bin/bash
echo "Hello world"
read text
$
I created a bookmark so:
name: test
command: /Users/chasrmartin/echoscript
Working directory: /Users/chasrmartin
When I open the bookmark test, I see my "Hello world", and it waits until I type return. When I type return, it goes away.

Resources