雑な備忘録が多いブログ

ももクロとエビ中を推している弱いパソコンオタクです

VSCode on Ubuntuがターミナルから起動出来ない時の対処法

以前は

$code hoge.txt

でターミナルからVScodeを起動出来てたが, どっかのアップデートでコマンドが変わってしまった模様.

以下は問題が起きたVSCodeの情報

Version: 1.53.2
Commit: 622cb03f7e070a9670c94bae1a45d78d7181fbd4
Date: 2021-02-11T11:48:44.518Z
Electron: 11.2.1
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.8.0-7642-generic

ディストリはPop!_OS 20.10.

探してみると/usr/share/code/bin/以下にcodeというシェルスクリプトを発見. こいつを叩くとVSCodeが呼ばれるらしい.
/usr/share/code/codeという同名のバイナリがあるが, そいつを直接叩くとelectronがこんな感じのエラーを吐く.

 sioremon@Pop!_OS : ~ $ cd /usr/share/code/
 sioremon@Pop!_OS : code $ ./code
(electron) Sending uncompressed crash reports is deprecated and will be removed in a future version of Electron. Set { compress: true } to opt-in to the new behavior. Crash reports will be uploaded gzipped, which most crash reporting servers support.
[main 2021-02-18T10:53:55.241Z] update#setState idle
bash: 端末プロセスグループを設定できません (-1): デバイスに対する不適切なioctlです
bash: このシェルではジョブ制御が無効になっています
(node:15187) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron.  See https://github.com/electron/electron/issues/23506 for more information
(node:15187) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron.  See https://github.com/electron/electron/issues/23506 for more information
^C sioremon@Pop!_OS : code $ 

$which codeしても何も出てこないので内部でどんな風に呼ばれているかは分からんが, とりあえず

alias code='/usr/share/code/bin/code'

を.bashrcに追記した(アップデートでまた問題が起こりそうな予感).