Cannot launch VS Code from WSL terminal after disabled the path sharing feature - visual-studio-code

I have export path in .bashrc. But when typecode in terminal, there is no response.
Debug output:
+ COMMIT=e5a624b788d92b8d34d1392e4c4d9789406efe8f
+ APP_NAME=code
+ QUALITY=stable
+ NAME=Code
+ DATAFOLDER=.vscode
+ realpath /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/bin/code
+ dirname /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/bin/code
+ dirname /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/bin
+ VSCODE_PATH=/mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code
+ ELECTRON=/mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/Code.exe
+ IN_WSL=false
+ [ -n Ubuntu-20.04 ]
+ IN_WSL=true
+ [ true = true ]
+ export WSLENV=ELECTRON_RUN_AS_NODE/w:WT_SESSION::WT_PROFILE_ID
+ wslpath -m /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js
+ CLI=C:/Users/Chen/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js
+ WSL_EXT_ID=ms-vscode-remote.remote-wsl
+ ELECTRON_RUN_AS_NODE=1 /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/Code.exe C:/Users/Chen/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js --locate-extension ms-vscode-remote.remote-wsl
+ cat /tmp/remote-wsl-loc.txt
+ WSL_EXT_WLOC=
+ [ -n ]
+ ELECTRON_RUN_AS_NODE=1 /mnt/c/Users/Chen/AppData/Local/Programs/Microsoft VS Code/Code.exe C:/Users/Chen/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js .
+ exit 1

Related

Meson Build System -- Cross Compiling

This is my first time using the Meson build system and I'm doing a cross compilation of a simple project; it should be straight forward but I'm getting the following error and I hope you can provide some help with it.
meson.build:1:0: ERROR: Unable to detect linker for compiler ".\tools\gcc_compiler\bin\ppc-freevle-eabi-gcc -Wl,--version -c -mcpu=e200z4 -mvle -meabi -msdata=none -mregnames -O2 -gdwarf-2 -fomit-frame-pointer -falign-functions=16 -fno-gcse -std=gnu99"
This is what my cross_file.build looks like:
[constants]
compiler_path = '.\tools\gcc_compiler\bin\'
arch = 'ppc-freevle-eabi'
[binaries]
c = compiler_path + arch + '-gcc'
cpp = compiler_path + arch + '-cpp'
ld = compiler_path + arch + '-ld'
ar = compiler_path + arch + '-ar'
as = compiler_path + arch + '-as'
size = compiler_path + arch + '-size'
objdump = compiler_path + arch + '-objdump'
objcopy = compiler_path + arch + '-objcopy'
strip = compiler_path + arch + '-strip'
gdb = compiler_path + arch + '-gdb'
[built-in options]
c_args = [
'-c',
'-mcpu=e200z4',
'-mvle',
'-meabi',
'-msdata=none',
'-mregnames',
'-O2',
'-gdwarf-2',
'-fomit-frame-pointer',
'-falign-functions=16',
'-fno-gcse',
'-std=gnu99'
]
c_link_args = [
'-mcpu=e200z4',
'-mvle',
'-meabi',
'-msdata=none',
'-mregnames',
'-O2',
'-gdwarf-2',
'-fomit-frame-pointer',
'-falign-functions=16',
'-fno-gcse',
'-std=gnu99',
'-ffunction-sections',
'-fdata-sections',
'-fno-common',
'-nostartfiles',
'-Wl,-Map=build/out.map',
'--cref,--no-warn-mismatch,--library-path=,--gc-sections,-lm,-lc,-z,max-page-size=16384,--script=application.ld -o build/out.elf'
]
[host_machine]
system = 'windows'
cpu_family = 'x86'
cpu = 'i686'
endian = 'little'
If I execute the same command in the command line, I don't get any error, but for some reason meson does not like, any idea?
Thanks!

Compile a static version of pngquant

I'm trying to create a statically linked version of pngquant in Oracle Linux Server release 7.1. I've compiled the static version of zlib and the static version of libpng.
Then, when I configure pngquant, I always get the information that it will be linked with a shared version of zlib.
$ ./configure --with-libpng=../libpng-1.6.21 --extra-cflags="-I../zlib-1.2.8" --extra-ldflags="../zlib-1.2.8/libz.a"
Compiler: gcc
Debug: no
SSE: yes
OpenMP: no
libpng: static (1.6.21)
zlib: shared (1.2.7)
lcms2: no
If I execute make, in the output it seems that the options are correctly passed to the compiler. However, the resulting binary requires libz.so to be executed. It seems that my directives are ignored or that the installed version always takes precedence.
Is there any way of forcing pngquant to be compiled with the static version of zlib?
I'm not sure, if I got it right, but here's a patch to pngquant's configure that worked for me. configure now accepts --with-zlib=<dir> as parameter. Store it to pngquant.patch and apply it with patch -uN -p1 -i pngquant.patch.
diff -ur pngquant-2.9.0/configure pngquant-2.9.0.fixed/configure
--- pngquant-2.9.0/configure 2017-03-06 09:37:30.000000000 +0100
+++ pngquant-2.9.0.fixed/configure 2017-03-07 09:57:20.246012152 +0100
## -48,6 +48,7 ##
help "--with-cocoa/--without-cocoa use Cocoa framework to read images"
fi
help "--with-libpng=<dir> search for libpng in directory"
+ help "--with-zlib=<dir> search for zlib in directory"
echo
help "CC=<compiler> use given compiler command"
help "CFLAGS=<flags> pass options to the compiler"
## -97,6 +98,9 ##
--with-libpng=*)
LIBPNG_DIR=${i#*=}
;;
+ --with-zlib=*)
+ ZLIB_DIR=${i#*=}
+ ;;
--prefix=*)
PREFIX=${i#*=}
;;
## -238,6 +242,19 ##
echo "${MAJ}${MIN}"
}
+# returns full zlib.h version string
+zlibh_string() {
+ echo "$(grep -m1 "define ZLIB_VERSION" "$1" | \
+ grep -Eo '"[^"]+"' | grep -Eo '[^"]+')"
+}
+
+# returns major minor version numbers from png.h
+zlibh_majmin() {
+ local MAJ=$(grep -m1 "define ZLIB_VER_MAJOR" "$1" | grep -Eo "[0-9]+")
+ local MIN=$(grep -m1 "define ZLIB_VER_MINOR" "$1" | grep -Eo "[0-9]+")
+ echo "${MAJ}${MIN}"
+}
+
error() {
status "$1" "error ... $2"
echo
## -420,11 +437,42 ##
error "libpng" "not found (try: $LIBPNG_CMD)"
fi
-# zlib
-if ! find_library "zlib" "z" "zlib.h" "libz.a" "libz.$SOLIBSUFFIX*"; then
- error "zlib" "not found (please install zlib-devel package)"
+# try if given flags are enough for zlib
+HAS_ZLIB=0
+if echo "#include \"zlib.h\"
+ int main(){
+ uLong test = zlibCompileFlags();
+ return 0;
+}" | "$CC" -xc -std=c99 -o /dev/null $CFLAGS $LDFLAGS - &> /dev/null; then
+ status "zlib" "custom flags"
+ HAS_ZLIB=1
fi
+if [ "$HAS_ZLIB" -eq 0 ]; then
+ # try static in the given directory
+ ZLIBH=$(find_h "$ZLIB_DIR" "zlib.h")
+ if [ -n "$ZLIBH" ]; then
+ ZLIBH_STRING=$(zlibh_string "$ZLIBH")
+ ZLIBH_MAJMIN=$(zlibh_majmin "$ZLIBH")
+ if [[ -n "$ZLIBH_STRING" && -n "$ZLIBH_MAJMIN" ]]; then
+ ZLIBA=$(find_f "$ZLIB_DIR" "libz${ZLIBH_MAJMIN}.a")
+ if [ -z "$ZLIBA" ]; then
+ ZLIBA=$(find_f "$ZLIB_DIR" "libz.a")
+ fi
+ if [ -n "$ZLIBA" ]; then
+ cflags "-I${ZLIBH%/*}"
+ lflags "${ZLIBA}"
+ status "zlib" "static (${ZLIBH_STRING})"
+ HAS_ZLIB=1
+ fi
+ fi
+ fi
+fi
+# zlib
+if ! find_library "zlib" "z" "zlib.h" "libz.a" "zlib.$SOLIBSUFFIX*"; then
+ error "zlib" "not found (please install zlib-devel package)"
+fi
+
# lcms2
if [ "$LCMS2" != 0 ]; then
if find_library "lcms2" "lcms2" "lcms2.h" "liblcms2.a" "liblcms2.$SOLIBSUFFIX*"; then
Sorry, the configure script does not support it. It shouldn't be too hard to modify configure to pass appropriate flags to pkg-config or do the same workaround it does for libpng.

Logstash v2.2.0 fails to start as a service

+ PATH=/sbin:/usr/sbin:/bin:/usr/bin
+ export PATH
+ id -u
+ [ 0 -ne 0 ]
+ name=logstash
+ pidfile=/var/run/logstash.pid
+ LS_USER=logstash
+ LS_GROUP=logstash
+ LS_HOME=/var/lib/logstash
+ LS_HEAP_SIZE=1g
+ LS_LOG_DIR=/var/log/logstash
+ LS_LOG_FILE=/var/log/logstash/logstash.log
+ LS_CONF_DIR=/etc/logstash/conf.d
+ LS_OPEN_FILES=16384
+ LS_NICE=19
+ LS_OPTS=
+ [ -r /etc/default/logstash ]
+ . /etc/default/logstash
+ KILL_ON_STOP_TIMEOUT=0
+ [ -r /etc/sysconfig/logstash ]
+ program=/opt/logstash/bin/logstash
+ args=agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
+ status
+ [ -f /var/run/logstash.pid ]
+ cat /var/run/logstash.pid
+ pid=12716
+ kill -0 12716
+ return 2
+ code=2
+ [ 2 -eq 0 ]
+ start
+ LS_JAVA_OPTS= -Djava.io.tmpdir=/var/lib/logstash
+ HOME=/var/lib/logstash
+ export PATH HOME LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
+ id -Gn logstash
+ + sed s/,$//
tr ,
+ echo
+ SGROUPS=logstash
+ [ ! -z logstash ]
+ EXTRA_GROUPS=--groups logstash
+ ulimit -n 16384
+ echo 22073
+ echo logstash started.
logstash started.
+ return 0
+ code=0
+ exit 0
+ nice -n 19 chroot --userspec logstash:logstash --groups logstash / sh -c
cd /var/lib/logstash
ulimit -n 16384
exec "/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
The above is the command output when the logstash service is started.
(Got this by adding -x switch to the start of the init.d script - #!/bin/sh -x)
Logstash v2.2.0 is installed using the DEB package on Ubuntu 14.04
When I run the exec command that is used by the init script (as seen in the above output) logstash startups pretty fine and works flawlessly
"/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
There is something in the init.d service script that causes logstash to fail as a service. I suspect the nice command that the init script uses.
Do you guys see any issues with the 'nice' command that is being used in the init script ?
+ nice -n 19 chroot --userspec logstash:logstash --groups logstash / sh -c
cd /var/lib/logstash
ulimit -n 16384
exec "/opt/logstash/bin/logstash" agent -f /etc/logstash/conf.d -l /var/log/logstash/logstash.log
When you have uninstalled older version, the logstash user and group was also removed. Now with new installation a new logstash user and group was created with different uid and gid. Yet the ownership of common logstash directories belongs to the old logstash uid and gid.
Now when you start new logstash it tries to read/write to this dir and fails hence logstash not running.
Try changing ownership of these dir and start logstash
chown -R logstash:logstash /var/log/logstash
chown -R logstash:logstash /var/lib/logstash
chown -R logstash:logstash /etc/logstash
rm -rf /var/run/logstash.pid
/etc/init.d/logstash start

Scala Process for Linux is stuck

I'm trying to use Scala Process in order to concate two files and send the result to a new file.
The code works fine, but when i remove the permissions to the folder, it seems to be stuck.
Here is the code:
val copyCommand = Seq("bash", "-c", "cat \"" + headerPath + "\" \"" + FilePath + "\"")
Process(copyCommand).#>>(new File(FileWithHeader)).!
Maybe something like this can help (without invoking bash)?
import sys.process._
(Seq("cat", "file-1.txt", "file-2.txt") #>> new java.io.File("files-1n2.txt")).!
I preformed the concatination in the same comend without creating new file and it's work fine:
val copyCommand = Seq("bash", "-c", "cat \"" + headerPath + "\" \"" + FilePath + "\">FileWithHeader")
Process(copyCommand).#!

How to go to a particular line in Zend Studio 12 with a keyboard shortcut

What is the shortcut to go to a particular line in Zend Studio 12, in the same way that CTRL + G works in NetBeans IDE and Notepad++?
Also, how can I get all the shortcuts of Zend Studio 12?
CTRL + L is the short cut to go to line directly.
If you want to see a full list of shortcuts, in Zend Studio go to :
Window--> Preferences--> General--> Keys.
To bring up a list of commonly used commands, press Ctrl+ Shift+ L in the Editor.
Source : commonly used keyboard shortcuts
Manage
Ctrl + N Add New Document
Ctrl + O Open Document
Ctrl + F4 Close Document/Window
Ctrl + Shft + F4 Close All
Ctrl + Shft + O Open Project
Ctrl + Shft + N New Project
Ctrl + S Save File
Ctrl + Shft + S Save As
Ctrl + Alt + S Save All
Editor
Ctrl + Space Show Code Completion
Ctrl + Space + Shft Show Function Arguments
Ctrl + Shft + F Reformat Code
Ctrl + / Add Remove Comment
Ctrl + / + Shft Add Remove PHP Block Comment
Ctrl + W Toggle Line Wrap
Ctrl + Z Undo
Ctrl + Y Redo
Ctrl + E Erase Line
Ctrl + D Duplicate Selection
Ctrl + L Change Selection to Lower Case
Ctrl + U Change Selection to Upper Case
Ctrl + B Bold Tag
Alt + I Italic Tag
Ctrl + - [1-3] Heading 1-3 Tag
Ctrl + Enter Break Tag
Ctrl + Back + Quote NBSP Tag
F1 Open Function Help
Code Folding
Ctrl + Shft + 1 Collapse All Non-PHP
Ctrl + Shft + 2 Collapse All Classes
Ctrl + Shft + 3 Collapse All Functions
Ctrl + Shft + 4 Collapse All DocBlocks
Ctrl + Shft + 9 Fold in Scope
Ctrl + Shft + E Expand All Folds
Ctrl + Shft + C Collapse All Folds
Debugging & Profiling
F8 Debug URL
F12 Profile URL
Ctrl + F5 Run
F5 Go
F10 Step Over
F11 Step Into
Shft + F1 1 Step Out
Shft + F5 Stop Debug
Shft + F10 Go to Cursor
F9 Toggle Breakpoint
Shft + F8 Add Watch
Ctrl + Alt + B Show In Browser
Navigation
Ctrl + Alt + G Goto File
Ctrl + Shft + G Goto PHP Resource
Ctrl + G Goto Line
Ctrl + F2 Goto Next Bookmark
Alt + F2 Goto Next Project Bookmark
Ctrl + M Goto Matching Bracket
Alt + Left/Right Go Back/Forward
F2 Toggle Bookmark
Ctrl + Shft + F2 Remove All Bookmarks
Ctrl + Shft + M Open Bookmarks Dialog
Ctrl + Shft + R Show Recent Files
F4 Open Next Entry
Find/Replace
Ctrl + F Find
F3 Find Next
Shft + F3 Find Prev
Ctrl + H Replace
Ctrl + Alt + F Find In Files
CVS/Subversion
Alt + U Update
Alt + C Commit
Tools
Alt + Ctrl + A Analyze Code
Ctrl + Shft + I Check Include Files