You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can‘t attach remote linux process - sh failure #2444
sh: 1: [: Linux: unexpected operator
sh: 1: [: Linux: unexpected operator
please help me to solve this issue.
thanks.
Describe the bug
OS and Version: Windows 10 1803
VS Code Version: 1.26.1
C/C++ Extension Version: 0.18.0: August 17, 2018
Other extensions you installed (and if the issue persists after disabling them):
A clear and concise description of what the bug is.
To Reproduce Please include a code sample and launch.json configuration.
Steps to reproduce the behavior:
build the test and run it on ubuntu16.04.
Open the test code and Debug with attach.
I noted that the behaviour is changed by removing the pipeArg -c. What follows is the ouput in that case. I'm not really sure what is going on there but it does appear that the sh call has the -c arg even though it has been removed from the pipeArgs.
/bin/bash: sh -c 'uname && if [ Linux == Linux ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ Linux == Darwin ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi': No such file or directory
Command failed: "c:\windows\system32\bash.exe" "sh -c 'uname && if [ $(uname) == "Linux" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) == "Darwin" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi'"
/bin/bash: sh -c 'uname && if [ Linux == Linux ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ Linux == Darwin ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi': No such file or directory
In the mean time the workaround would be to modify .vscode\extensions\ms-vscode.cpptools-0.17.7\out\src\Debugger\attachToProcess.js located in your user profile folder (%userprofile% for Windows, ~/ for Linux).
Activity
Thanduel commentedon Aug 24, 2018
I have the same issue.
my versions
I noted that the behaviour is changed by removing the pipeArg -c. What follows is the ouput in that case. I'm not really sure what is going on there but it does appear that the sh call has the -c arg even though it has been removed from the pipeArgs.
Launch.json:
XZiar commentedon Aug 26, 2018
Same issue here.
output is:
Windows 10 1803 build 17134.228
vs code version 1.26.1
C/C++ Extension Version: 0.18.1
czgtest commentedon Aug 29, 2018
Same issue here when I debug c module solution
formulahendry commentedon Aug 29, 2018
Same issue here using C/C++ Extension Version: 0.18.1, while it is working using 0.17.7.
[-]Can‘t attach remote linux process on Windows[/-][+]Can‘t attach remote linux process on Windows - sh failure[/+][-]Can‘t attach remote linux process on Windows - sh failure[/-][+]Can‘t attach remote linux process - sh failure[/+]pieandcakes commentedon Aug 31, 2018
This seems to be affecting all instances of remote process picking due to this change #2340
pieandcakes commentedon Aug 31, 2018
Matt (@timedroid) pointed out what is wrong in #2473 and a fix.
In the mean time the workaround would be to modify
.vscode\extensions\ms-vscode.cpptools-0.17.7\out\src\Debugger\attachToProcess.jslocated in your user profile folder (%userprofile%for Windows,~/for Linux).Update line 92/93 to say:
The fix will be in the next update.
Fix sh command
Fix sh command (#2475)
Fix sh command (#2475)