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

shelljs

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shelljs - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

2

package.json
{
"name": "shelljs",
"version": "0.0.7",
"version": "0.0.8",
"author": "Artur Adib <aadib@mozilla.com>",

@@ -5,0 +5,0 @@ "description": "Portable Unix shell commands for Node.js",

@@ -153,3 +153,3 @@ # ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs)

+ `-R`: recursive
+ `-a`: all files (include files beginning with `.`)
+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)

@@ -181,4 +181,4 @@ Examples:

### cp('[options ,] source [,source ...], dest')
### cp('[options ,] source_array, dest')
### cp([options ,] source [,source ...], dest)
### cp([options ,] source_array, dest)
Available options:

@@ -250,4 +250,10 @@

+ `'-b', 'path'`: true if path is a block device
+ `'-c', 'path'`: true if path is a character device
+ `'-d', 'path'`: true if path is a directory
+ `'-e', 'path'`: true if path exists
+ `'-f', 'path'`: true if path is a regular file
+ `'-L', 'path'`: true if path is a symboilc link
+ `'-p', 'path'`: true if path is a pipe (FIFO)
+ `'-S', 'path'`: true if path is a socket

@@ -352,3 +358,3 @@ Examples:

+ `async`: Asynchronous execution. Needs callback.
+ `async`: Asynchronous execution. Defaults to true if a callback is provided.
+ `silent`: Do not echo program output to console.

@@ -365,2 +371,7 @@

});
exec('some_long_running_process', function(code, output) {
console.log('Exit code:', code);
console.log('Program output:', output);
});
```

@@ -367,0 +378,0 @@

@@ -9,4 +9,6 @@ #!/usr/bin/env node

echo('Running test:', file);
if (exec('node '+file).code !== 123) // 123 avoids false positives (e.g. premature exit)
if (exec('node '+file).code !== 123) { // 123 avoids false positives (e.g. premature exit)
failed = true;
echo('*** FAILED! (missing return code)');
}
});

@@ -13,0 +15,0 @@

@@ -67,3 +67,3 @@ //

//@ + `-R`: recursive
//@ + `-a`: all files (include files beginning with `.`)
//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
//@

@@ -82,5 +82,14 @@ //@ Examples:

'R': 'recursive',
'a': 'all'
'A': 'all',
'a': 'all_deprecated'
});
if (options.all_deprecated) {
// We won't support the -a option as it's hard to image why it's useful
// (it includes '.' and '..' in addition to '.*' files)
// For backwards compatibility we'll dump a deprecated message and proceed as before
log('ls: Option -a is deprecated. Use -A instead');
options.all = true;
}
if (!paths)

@@ -132,3 +141,3 @@ paths = ['.'];

if (fs.statSync(file).isDirectory())
list = list.concat(_ls('-R'+(options.all?'a':''), file+'/*'));
list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*'));
_cd('', oldDir);

@@ -161,3 +170,3 @@ }

if (fs.statSync(pp).isDirectory())
list = list.concat(_ls('-R'+(options.all?'a':''), pp+'/*'));
list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*'));
} // recursive

@@ -215,3 +224,3 @@ } // if file matches

if (fs.statSync(file).isDirectory()) {
_ls('-Ra', file+'/*').forEach(function(subfile) {
_ls('-RA', file+'/*').forEach(function(subfile) {
pushFile(subfile);

@@ -228,4 +237,4 @@ });

//@
//@ ### cp('[options ,] source [,source ...], dest')
//@ ### cp('[options ,] source_array, dest')
//@ ### cp([options ,] source [,source ...], dest)
//@ ### cp([options ,] source_array, dest)
//@ Available options:

@@ -583,3 +592,3 @@ //@

stats = fs.statSync(path);
var stats = fs.statSync(path);

@@ -867,3 +876,3 @@ if (options.block)

//@
//@ + `async`: Asynchronous execution. Needs callback.
//@ + `async`: Asynchronous execution. Defaults to true if a callback is provided.
//@ + `silent`: Do not echo program output to console.

@@ -880,2 +889,7 @@ //@

//@ });
//@
//@ exec('some_long_running_process', function(code, output) {
//@ console.log('Exit code:', code);
//@ console.log('Program output:', output);
//@ });
//@ ```

@@ -897,3 +911,3 @@ //@

callback = options;
options = {};
options = { async: true };
}

@@ -900,0 +914,0 @@

@@ -68,3 +68,3 @@ var shell = require('..');

// no callback (no need for asyncFlags)
// no callback
var c = shell.exec('node -e \"console.log(1234)\"', {async:true});

@@ -74,65 +74,22 @@ assert.equal(shell.error(), null);

var asyncFlags = [];
//
// callback as 2nd argument
//
asyncFlags[0] = false;
shell.exec('node -e \"console.log(5678);\"', {async:true}, function(code, output) {
shell.exec('node -e \"console.log(5678);\"', function(code, output) {
assert.equal(code, 0);
assert.ok(output === '5678\n' || output === '5678\nundefined\n'); // 'undefined' for v0.4
asyncFlags[0] = true;
//
// callback as 3rd argument
//
shell.exec('node -e \"console.log(5566);\"', {async:true}, function(code, output) {
assert.equal(code, 0);
assert.ok(output === '5566\n' || output === '5566\nundefined\n'); // 'undefined' for v0.4
// Most of the following code doesn't really belong here since it tests the sync version (stdout).
// However there seems to be a race condition with the stdout returned by child.exec()
// that makes the tests fail intermittently. So we're keeping them here in a chain
// to avoid this race issue
shell.exit(123);
// STILL SUFFERING INTERMITTENT FAILURES - COMMENTING OUT UNTIL THIS GETS SORTED OUT
});
shell.exit(123);
});
// //
// // check if stdout is proxied with default silent options (i.e. silent = false)
// //
// asyncFlags[1] = false;
// shell.mkdir('-p', 'tmp');
// var file = 'tmp/tempscript'+Math.random()+'.js',
// script = 'require(\'../../global.js\'); exec(\'node -e \"console.log(555);\"\')';
// script.to(file);
// child.exec('node '+file, function(err, stdout, stderr) {
// assert.ok(stdout === '555\n' || stdout === '555\nundefined\n'); // 'undefined' for v0.4
// asyncFlags[1] = true;
// //
// // check if stdout is proxied when: silent(true), {silent:false}
// //
// asyncFlags[2] = false;
// shell.mkdir('-p', 'tmp');
// var file = 'tmp/tempscript'+Math.random()+'.js',
// script = 'require(\'../../global.js\'); silent(true); exec(\'node -e \"console.log(333);\"\', {silent:false})';
// script.to(file);
// child.exec('node '+file, function(err, stdout, stderr) {
// assert.ok(stdout === '333\n' || stdout === '333\nundefined\n'); // 'undefined' for v0.4
// asyncFlags[2] = true;
// //
// // check if stdout is proxied when: silent(true), {silent:false} - async
// //
// asyncFlags[3] = false;
// shell.mkdir('-p', 'tmp');
// var file = 'tmp/tempscript'+Math.random()+'.js',
// script = 'require(\'../../global.js\'); silent(true); exec(\'node -e \"console.log(222);\"\', {silent:false, async:true})';
// script.to(file);
// child.exec('node '+file, function(err, stdout, stderr) {
// assert.ok(stdout === '222\n' || stdout === '222\nundefined\n'); // 'undefined' for v0.4
// asyncFlags[3] = true;
// shell.exit(123);
// });
// });
// });
});
assert.equal(shell.error(), null);

@@ -64,3 +64,3 @@ var shell = require('..');

shell.cd('resources/ls');
var result = shell.ls('-a');
var result = shell.ls('-A');
assert.equal(shell.error(), null);

@@ -78,2 +78,17 @@ assert.equal(result.indexOf('file1') > -1, true);

// no args, 'all' option
shell.cd('resources/ls');
var result = shell.ls('-a'); // (deprecated) backwards compatibility test
assert.equal(shell.error(), null);
assert.equal(result.indexOf('file1') > -1, true);
assert.equal(result.indexOf('file2') > -1, true);
assert.equal(result.indexOf('file1.js') > -1, true);
assert.equal(result.indexOf('file2.js') > -1, true);
assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
assert.equal(result.indexOf('a_dir') > -1, true);
assert.equal(result.indexOf('.hidden_file') > -1, true);
assert.equal(result.indexOf('.hidden_dir') > -1, true);
assert.equal(result.length, 8);
shell.cd('../..');
// wildcard, simple

@@ -173,3 +188,3 @@ var result = shell.ls('resources/ls/*');

// recusive, path given - 'all' flag
var result = shell.ls('-Ra', 'resources/ls');
var result = shell.ls('-RA', 'resources/ls');
assert.equal(shell.error(), null);

@@ -176,0 +191,0 @@ assert.equal(result.indexOf('a_dir') > -1, true);

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