Community Packages

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#70668 - [code] retry as sudo fix

Attached to Project: Community Packages
Opened by FederAndInk (FederAndInk) - Friday, 30 April 2021, 23:28 GMT
Last edited by Eli Schwartz (eschwartz) - Sunday, 02 May 2021, 02:40 GMT
Task Type Bug Report
Category Packages
Status Assigned
Assigned To Filipe LaĆ­ns (FFY00)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


I've seen
I found a solution (and a sed command that should be updated in the PKGBUILD)

Additional info:
* package version(s)
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:
first here is the updated sed command:
diff --git a/repos/community-x86_64/PKGBUILD b/repos/community-x86_64/PKGBUILD
index 769ac2c7..353a2399 100644
--- a/repos/community-x86_64/PKGBUILD
+++ b/repos/community-x86_64/PKGBUILD
@@ -92,9 +92,9 @@ prepare() {
sed -i 's|@@APPNAME@@|code-oss|g' resources/completions/{bash/code-oss,zsh/_code-oss}

# Fix bin path
- sed -i "s|return path.join(path.dirname(execPath), 'bin', \`\${product.applicationName}\`);|return '/usr/bin/code';|g
- s|return path.join(appRoot, 'scripts', '');|return '/usr/bin/code';|g" \
- src/vs/platform/environment/node/environmentService.ts
+ sed -i "s|return join(dirname(process.execPath), 'bin', \`\${this.productService.applicationName}\`);|return '/usr/bin/code';|g
+ s|return join(this.environmentMainService.appRoot, 'scripts', '');|return '/usr/bin/code';|g" \
+ src/vs/platform/native/electron-main/nativeHostMainService.ts

build() {

Then, in src/vs/code/node/cli.ts drop the argument 0 because args._[0] is '/usr/lib/code/code.js'.

diff --git a/src/vs/code/node/cli.ts b/src/vs/code/node/cli.ts
index c1285622ed0..46d9f1b7698 100644
--- a/src/vs/code/node/cli.ts
+++ b/src/vs/code/node/cli.ts
@@ -63,8 +63,8 @@ export async function main(argv: string[]): Promise<any> {

// Write File
else if (args['file-write']) {
- const source = args._[0];
- const target = args._[1];
+ const source = args._[1];
+ const target = args._[2];

// Validate
if (

It's a workaround but at least it works, you surely have a better idea on how to remove this first argument,
I saw that it's done in /usr/lib/code/code.js but in /usr/bin/code-oss cli.js seems to be called before,
I don't really know how all the pieces come together.

I Hope this will help
This task depends upon