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

run-pty

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

run-pty - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

### Version 2.1.0 (2020-08-06)
run-pty now works on Windows!
Also, in `NO_COLOR` mode you no longer get colored emoji.
### Version 2.0.0 (2020-08-03)

@@ -2,0 +8,0 @@

6

package.json
{
"name": "run-pty",
"version": "2.0.0",
"version": "2.1.0",
"author": "Simon Lydell",

@@ -32,4 +32,4 @@ "license": "MIT",

"@types/jest": "26.0.8",
"@typescript-eslint/eslint-plugin": "3.7.1",
"@typescript-eslint/parser": "3.7.1",
"@typescript-eslint/eslint-plugin": "3.8.0",
"@typescript-eslint/parser": "3.8.0",
"eslint": "7.6.0",

@@ -36,0 +36,0 @@ "eslint-plugin-jest": "23.20.0",

@@ -58,5 +58,13 @@ #!/usr/bin/env node

const runningIndicator = "🟢";
const runningIndicator = NO_COLOR
? "›"
: IS_WINDOWS
? `\x1B[92m●${RESET_COLOR}`
: "🟢";
const killingIndicator = "⭕";
const killingIndicator = NO_COLOR
? "○"
: IS_WINDOWS
? `\x1B[91m○${RESET_COLOR}`
: "⭕";

@@ -67,3 +75,14 @@ /**

*/
const exitIndicator = (exitCode) => (exitCode === 0 ? "⚪" : "🔴");
const exitIndicator = (exitCode) =>
exitCode === 0
? NO_COLOR
? "●"
: IS_WINDOWS
? `\x1B[97m●${RESET_COLOR}`
: "⚪"
: NO_COLOR
? "×"
: IS_WINDOWS
? `\x1B[91m●${RESET_COLOR}`
: "🔴";

@@ -176,3 +195,3 @@ /**

0,
...lines.map(([, status]) => Array.from(status).length)
...lines.map(([, status]) => Array.from(removeColor(status)).length)
);

@@ -288,10 +307,8 @@

*/
const padEnd = (string, maxLength) => {
const chars = Array.from(string);
return chars
.concat(
Array.from({ length: Math.max(0, maxLength - chars.length) }, () => " ")
)
.join("");
};
const padEnd = (string, maxLength) =>
string +
Array.from(
{ length: Math.max(0, maxLength - Array.from(removeColor(string)).length) },
() => " "
).join("");

@@ -305,3 +322,16 @@ /**

.map((part) =>
/^[\w.,:/=@%+-]+$/.test(part) ? part : `'${part.replace(/'/g, "’")}'`
part === ""
? "''"
: part
.split(/(')/)
.map((subPart) =>
subPart === ""
? ""
: subPart === "'"
? "\\'"
: /^[\w.,:/=@%+-]+$/.test(subPart)
? subPart
: `'${subPart}'`
)
.join("")
)

@@ -311,2 +341,20 @@ .join(" ");

/**
* @param {string} arg
* @returns {string}
*/
const cmdEscapeMetaChars = (arg) =>
// https://qntm.org/cmd
arg.replace(/[()%!^"<>&|;, ]/g, "^$&");
/**
* @param {string} arg
* @returns {string}
*/
const cmdEscapeArg = (arg) =>
// https://qntm.org/cmd
cmdEscapeMetaChars(
`"${arg.replace(/(\\*)"/g, '$1$1\\"').replace(/(\\+)$/, "$1$1")}"`
);
/**
* @typedef {

@@ -408,3 +456,16 @@ | { tag: "Help" }

const terminal = pty.spawn(this.file, this.args, {
const [file, args] = IS_WINDOWS
? [
"cmd.exe",
[
"/d",
"/s",
"/q",
"/c",
cmdEscapeMetaChars(this.file),
...this.args.map(cmdEscapeArg),
].join(" "),
]
: [this.file, this.args];
const terminal = pty.spawn(file, args, {
cols: process.stdout.columns,

@@ -792,5 +853,3 @@ rows: process.stdout.rows,

if (!process.stdin.isTTY) {
console.error(
"run-pty must be connected to a terminal (“is TTY”) to run properly."
);
console.error("run-pty requires stdin to be a TTY to run properly.");
process.exit(1);

@@ -797,0 +856,0 @@ }

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