Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@yarnpkg/shell

Package Overview
Dependencies
Maintainers
5
Versions
122
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yarnpkg/shell - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

57

lib/index.js

@@ -13,2 +13,43 @@ "use strict";

const pipe_2 = require("./pipe");
var StreamType;
(function (StreamType) {
StreamType[StreamType["Readable"] = 1] = "Readable";
StreamType[StreamType["Writable"] = 2] = "Writable";
})(StreamType || (StreamType = {}));
function getFileDescriptorStream(fd, type, state) {
const stream = new stream_1.PassThrough({ autoDestroy: true });
switch (fd) {
case pipe_1.Pipe.STDIN:
{
if ((type & StreamType.Readable) === StreamType.Readable)
state.stdin.pipe(stream, { end: false });
if ((type & StreamType.Writable) === StreamType.Writable && state.stdin instanceof stream_1.Writable) {
stream.pipe(state.stdin, { end: false });
}
}
break;
case pipe_1.Pipe.STDOUT:
{
if ((type & StreamType.Readable) === StreamType.Readable)
state.stdout.pipe(stream, { end: false });
if ((type & StreamType.Writable) === StreamType.Writable) {
stream.pipe(state.stdout, { end: false });
}
}
break;
case pipe_1.Pipe.STDERR:
{
if ((type & StreamType.Readable) === StreamType.Readable)
state.stderr.pipe(stream, { end: false });
if ((type & StreamType.Writable) === StreamType.Writable) {
stream.pipe(state.stderr, { end: false });
}
}
break;
default: {
throw new Error(`Bad file descriptor: ${fd}`);
}
}
return stream;
}
function cloneState(state, mergeWith = {}) {

@@ -37,2 +78,5 @@ const newState = { ...state, ...mergeWith };

}],
[`:`, async (args, opts, state) => {
return 0;
}],
[`true`, async (args, opts, state) => {

@@ -92,2 +136,7 @@ return 0;

break;
case `<&`:
{
inputs.push(() => getFileDescriptorStream(Number(args[u]), StreamType.Readable, state));
}
break;
case `>`:

@@ -103,2 +152,10 @@ {

break;
case `>&`:
{
outputs.push(getFileDescriptorStream(Number(args[u]), StreamType.Writable, state));
}
break;
default: {
throw new Error(`Unsupported redirection type: "${type}"`);
}
}

@@ -105,0 +162,0 @@ }

1

lib/pipe.d.ts

@@ -5,2 +5,3 @@ /// <reference types="node" />

export declare enum Pipe {
STDIN = 0,
STDOUT = 1,

@@ -7,0 +8,0 @@ STDERR = 2

3

lib/pipe.js

@@ -9,2 +9,3 @@ "use strict";

(function (Pipe) {
Pipe[Pipe["STDIN"] = 0] = "STDIN";
Pipe[Pipe["STDOUT"] = 1] = "STDOUT";

@@ -59,3 +60,3 @@ Pipe[Pipe["STDERR"] = 2] = "STDERR";

break;
case `EACCESS`:
case `EACCES`:
{

@@ -62,0 +63,0 @@ stdio[2].write(`permission denied: ${name}\n`);

{
"name": "@yarnpkg/shell",
"version": "2.3.0",
"version": "2.4.0",
"license": "BSD-2-Clause",

@@ -8,4 +8,4 @@ "main": "./lib/index.js",

"dependencies": {
"@yarnpkg/fslib": "^2.2.2",
"@yarnpkg/parsers": "^2.2.1",
"@yarnpkg/fslib": "^2.3.0",
"@yarnpkg/parsers": "^2.3.0",
"clipanion": "^2.6.2",

@@ -12,0 +12,0 @@ "cross-spawn": "7.0.3",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc