question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to open multiple separate instances of shells in one .js file?

See original GitHub issue

Node version (or tell us if you’re using electron or some other framework):

ShellJS version (the most recent version/Github branch you see the bug on):

Operating system:

Description of the bug:

Example ShellJS command to reproduce the error:


Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nfischercommented, Jun 30, 2018

Right. You can provide CLI arguments like so:

// bootstrap.js

shell.exec('node file1.js foo bar', { async: true });

And you can retrieve these arguments with:

// file.js

var args = process.argv.slice(2); // optionally, check out the minimist module
// `args` is [ 'foo', 'bar' ]
0reactions
adityankcommented, Jun 30, 2018

Thank you!

So in file{}.js how do I access shelljs? Is the following right? And how do I send arguments to file{}.js ?

//file1.js
var shell1 = require('shelljs')

shell1.exec("echo 'Hello, World!'")
```
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to load multiple js files to database using mongo shell?
I have two js files script1.js and script2.js , for example. From OS command line specify all the files: mongo localhost/testdb script1.
Read more >
4 Solutions To Run Multiple Node.js or NPM Commands ...
Today, I will share four ways to run multiple Node.js commands or NPM ... One is pure shell scripting, two are popular, stable...
Read more >
How would I go about executing multiple script files in a single ...
Everytime, test.js or any other file gets called only with 1 VU and 1 Iteration. APPROACH 2. Create shell script, lets say start.sh....
Read more >
User and Workspace Settings - Visual Studio Code
When you open a workspace, you will see at least the following two scopes: ... For example, @feature:explorer shows settings of the File...
Read more >
API - esbuild
There are two main API calls in esbuild's API: transform and build. ... The build API call operates on one or more files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found