Skip to content

Commit

Permalink
fix(core): replace binjumper with cmd script without prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Dec 3, 2020
1 parent 6b9df77 commit 1b5ef31
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 25 deletions.
10 changes: 0 additions & 10 deletions .pnp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
32 changes: 32 additions & 0 deletions .yarn/versions/2859f37f.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/core": patch
"@yarnpkg/plugin-dlx": patch
"@yarnpkg/plugin-essentials": patch
"@yarnpkg/plugin-exec": patch
"@yarnpkg/plugin-init": patch
"@yarnpkg/plugin-workspace-tools": patch
"@yarnpkg/pnpify": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-file"
- "@yarnpkg/plugin-git"
- "@yarnpkg/plugin-github"
- "@yarnpkg/plugin-http"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-link"
- "@yarnpkg/plugin-node-modules"
- "@yarnpkg/plugin-npm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- vscode-zipfs
- "@yarnpkg/builder"
- "@yarnpkg/doctor"
- "@yarnpkg/pnp"
1 change: 0 additions & 1 deletion packages/yarnpkg-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@yarnpkg/parsers": "workspace:^2.3.0",
"@yarnpkg/pnp": "workspace:^2.3.2",
"@yarnpkg/shell": "workspace:^2.4.1",
"binjumper": "^0.1.4",
"camelcase": "^5.3.1",
"chalk": "^3.0.0",
"ci-info": "^2.0.0",
Expand Down
9 changes: 3 additions & 6 deletions packages/yarnpkg-core/sources/scriptUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {CwdFS, Filename, NativePath, PortablePath, ZipOpenFS} from '@yarnpkg/fsl
import {xfs, npath, ppath, toFilename} from '@yarnpkg/fslib';
import {getLibzipPromise} from '@yarnpkg/libzip';
import {execute} from '@yarnpkg/shell';
import {getBinjumper} from "binjumper";
import capitalize from 'lodash/capitalize';
import pLimit from 'p-limit';
import {PassThrough, Readable, Writable} from 'stream';
Expand Down Expand Up @@ -30,11 +29,9 @@ enum PackageManager {

async function makePathWrapper(location: PortablePath, name: Filename, argv0: NativePath, args: Array<string> = []) {
if (process.platform === `win32`) {
await Promise.all([
xfs.writeFilePromise(ppath.format({dir: location, name, ext: `.exe`}), getBinjumper()),
xfs.writeFilePromise(ppath.format({dir: location, name, ext: `.exe.info`}), [argv0, ...args].join(`\n`)),
xfs.writeFilePromise(ppath.format({dir: location, name, ext: `.cmd`}), `@"${argv0}" ${args.map(arg => `"${arg.replace(`"`, `""`)}"`).join(` `)} %*\n`),
]);
// https://github.com/microsoft/terminal/issues/217#issuecomment-737594785
const cmdScript = `@echo off\ngoto #_undefined_# 2>NUL || title %COMSPEC% & "${argv0}" ${args.map(arg => `"${arg.replace(`"`, `""`)}"`).join(` `)} %*`;
await xfs.writeFilePromise(ppath.format({dir: location, name, ext: `.cmd`}), cmdScript);
}

await xfs.writeFilePromise(ppath.join(location, name), `#!/bin/sh\nexec "${argv0}" ${args.map(arg => `'${arg.replace(/'/g, `'"'"'`)}'`).join(` `)} "$@"\n`);
Expand Down
8 changes: 0 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5495,7 +5495,6 @@ __metadata:
"@yarnpkg/plugin-pnp": "workspace:^2.4.0"
"@yarnpkg/pnp": "workspace:^2.3.2"
"@yarnpkg/shell": "workspace:^2.4.1"
binjumper: ^0.1.4
camelcase: ^5.3.1
chalk: ^3.0.0
ci-info: ^2.0.0
Expand Down Expand Up @@ -7695,13 +7694,6 @@ __metadata:
languageName: node
linkType: hard

"binjumper@npm:^0.1.4":
version: 0.1.4
resolution: "binjumper@npm:0.1.4"
checksum: 07b0f2cf66698c0087e5916e0848ad4a7a0c85b6980689cea443baef9beac2001d4b818d9b99347208eef2b9dfa17095e84b617e472efdea694e7009b54cad91
languageName: node
linkType: hard

"bl@npm:^1.0.0":
version: 1.2.2
resolution: "bl@npm:1.2.2"
Expand Down

0 comments on commit 1b5ef31

Please sign in to comment.