Code Monkey home page Code Monkey logo

Comments (11)

coderaiser avatar coderaiser commented on June 19, 2024

redrun should work on windows machines. Could you run this command in command line:

dir & dir

Do you use cmd.exe or anything else? What windows version do you use?

from redrun.

stsiarzhanau avatar stsiarzhanau commented on June 19, 2024

I tried to use cmder, GitBash, default Windows console and finally Windows PowerShell.
With my script > redrun -p serve:src lint:watch there's no difference which one I use.
Server starts, no linter output.

When I try > dir & dir in all above mentioned terminals except PowerShell i see content of my CWD being printed 2 times.
Powershell barks at & operator...

When I try something simple, like:

  "scripts": {
    "one": "mkdir 11",
    "two": "mkdir 22",
    "three": "redrun -p one two" // or redrun -s one two
  }, 

I get expected result:

> redrun -p one two
> mkdir 11 & mkdir 22

or

> redrun -s one two
> mkdir 11 && mkdir 22

and two brand new folders.

So problem is with tasks that I try to run in parallel and that not exit until I kill them with Ctrl+C (like my serve:src and lint:watch tasks).

As with npm-run-all I get expected result (server and linter start in parallel, I see server log and linter output in the same console window) I think problem is not with my scripts itself.

Versions:
Windows_NT 10.0.14393
node v6.9.1
npm v3.10.8
redrun v5.9.5
npm-run-all v.4.0.0

P.S. Maybe with redrun 2nd task starts, but starts in background and so I can't see output?

from redrun.

coderaiser avatar coderaiser commented on June 19, 2024

Could you please provide me redrun input (with additional code) which I can use to reproduce this bug?

from redrun.

stsiarzhanau avatar stsiarzhanau commented on June 19, 2024

I've just created GitHub repo.
Both npm-run-all and redrun are in project dependencies, so just run npm install.
Run npm start to see how everything works with npm-run-all.
Then change start script to use redrun instead.
Do you have consistent behaviour on your system?

from redrun.

coderaiser avatar coderaiser commented on June 19, 2024

On Mac OS I see next things.

With npm-run-all:

> [email protected] prestart /Users/abc/webpack-react-redux-starter
> babel-node tools/startMessage.js


=>  Starting development server to serve files from src folder...
=>  mocha and ESLint will run in watch mode...
=>  Hot Module Replacement, React Hot Loader 3, Browsersync...

:)  Enjoy!


> [email protected] start /Users/abc/webpack-react-redux-starter
> run-p serve:src lint:watch


> [email protected] serve:src /Users/abc/webpack-react-redux-starter
> cross-env NODE_ENV=development babel-node tools/srcServer.js


> [email protected] lint:watch /Users/abc/webpack-react-redux-starter
> esw src tools webpackConfig --color --watch


[BS]  Browsersync server is running.
[BS]  NODE_ENV is set to development.
[BS]  Access URLs are listed below.
    
[BS] Access URLs:
 -----------------------------------
       Local: http://localhost:3004
    External: http://1.0.0.79:3004
 -----------------------------------
          UI: http://localhost:3005
 UI External: http://1.0.0.79:3005
 -----------------------------------
[BS] Serving files from: src
[BS] Watching files...
/Users/abc/webpack-react-redux-starter/src/components/Layout.js (2/0)
  ✖  5:1  Unexpected var, use let or const instead  no-var
  ✖  5:5  'a' is defined but never used             no-unused-vars

✖ 2 errors (4:30:22 PM)
webpack built 9cc81e74124164753ae6 in 5485ms
Version: webpack 2.2.0-rc.4
     Asset     Size  Chunks                    Chunk Names
 bundle.js  2.79 MB       0  [emitted]  [big]  main
index.html  1.21 kB          [emitted]         
Entrypoint main [big] = bundle.js
chunk    {0} bundle.js (main) 960 kB [entry] [rendered]
    > main [0] 
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0  
    Entrypoint undefined = index.html
    chunk    {0} index.html 542 kB [entry] [rendered]
        > [../node_modules/html-webpack-plugin/lib/loader.js!./index.ejs] 
webpack: bundle is now VALID.

With redrun:

> babel-node tools/startMessage.js && cross-env NODE_ENV=development babel-node tools/srcServer.js & esw src tools webpackConfig --color --watch

=>  Starting development server to serve files from src folder...
=>  mocha and ESLint will run in watch mode...
=>  Hot Module Replacement, React Hot Loader 3, Browsersync...

:)  Enjoy!

/Users/abc/webpack-react-redux-starter/src/components/Layout.js (2/0)
  ✖  5:1  Unexpected var, use let or const instead  no-var
  ✖  5:5  'a' is defined but never used             no-unused-vars

✖ 2 errors (4:27:01 PM)

[BS]  Browsersync server is running.
[BS]  NODE_ENV is set to development.
[BS]  Access URLs are listed below.
    
[BS] Access URLs:
 -----------------------------------
       Local: http://localhost:3000
    External: http://1.0.0.79:3000
 -----------------------------------
          UI: http://localhost:3001
 UI External: http://1.0.0.79:3001
 -----------------------------------
[BS] Serving files from: src
[BS] Watching files...
webpack built 9cc81e74124164753ae6 in 7875ms
Version: webpack 2.2.0-rc.4
     Asset     Size  Chunks                    Chunk Names
 bundle.js  2.79 MB       0  [emitted]  [big]  main
index.html  1.21 kB          [emitted]         
Entrypoint main [big] = bundle.js
chunk    {0} bundle.js (main) 960 kB [entry] [rendered]
    > main [0] 
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0  
    Entrypoint undefined = index.html
    chunk    {0} index.html 542 kB [entry] [rendered]
        > [../node_modules/html-webpack-plugin/lib/loader.js!./index.ejs] 
webpack: bundle is now VALID.

What output do you have on Windows?

from redrun.

stsiarzhanau avatar stsiarzhanau commented on June 19, 2024

With npm-run-all:

C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter (master) ([email protected])
λ npm start

> [email protected] prestart C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> babel-node tools/startMessage.js


=>  Starting development server to serve files from src folder...
=>  mocha and ESLint will run in watch mode...
=>  Hot Module Replacement, React Hot Loader 3, Browsersync...

:)  Enjoy!


> [email protected] start C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> run-p serve:src lint:watch


> [email protected] serve:src C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> cross-env NODE_ENV=development babel-node tools/srcServer.js


> [email protected] lint:watch C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> esw src tools webpackConfig --color --watch

C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter\src\components\Layout.js (2/0)
  ✖  5:1  Unexpected var, use let or const instead  no-var
  ✖  5:5  'a' is defined but never used             no-unused-vars

✖ 2 errors (17:37:00)

[BS]  Browsersync server is running.
[BS]  NODE_ENV is set to development.
[BS]  Access URLs are listed below.

[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.100.2:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.100.2:3001
 --------------------------------------
[BS] Serving files from: src
[BS] Watching files...
webpack built 4066f97aaccd536074a4 in 2442ms
Version: webpack 2.2.0-rc.4
     Asset     Size  Chunks                    Chunk Names
 bundle.js  2.79 MB       0  [emitted]  [big]  main
index.html  1.21 kB          [emitted]
Entrypoint main [big] = bundle.js
chunk    {0} bundle.js (main) 960 kB [entry] [rendered]
    > main [0]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0
    Entrypoint undefined = index.html
    chunk    {0} index.html 542 kB [entry] [rendered]
        > [../node_modules/html-webpack-plugin/lib/loader.js!./index.ejs]
webpack: bundle is now VALID.

With redrun:

C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter (master) ([email protected])
λ npm start

> [email protected] prestart C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> babel-node tools/startMessage.js


=>  Starting development server to serve files from src folder...
=>  mocha and ESLint will run in watch mode...
=>  Hot Module Replacement, React Hot Loader 3, Browsersync...

:)  Enjoy!


> [email protected] start C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> redrun -p serve:src lint:watch

> cross-env NODE_ENV=development babel-node tools/srcServer.js & esw src tools webpackConfig --color --watch

[BS]  Browsersync server is running.
[BS]  NODE_ENV is set to development.
[BS]  Access URLs are listed below.

[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.100.2:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.100.2:3001
 --------------------------------------
[BS] Serving files from: src
[BS] Watching files...
webpack built d2bc411306b7859e47de in 2352ms
Version: webpack 2.2.0-rc.4
     Asset     Size  Chunks                    Chunk Names
 bundle.js  2.79 MB       0  [emitted]  [big]  main
index.html  1.21 kB          [emitted]
Entrypoint main [big] = bundle.js
chunk    {0} bundle.js (main) 960 kB [entry] [rendered]
    > main [0]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0
    Entrypoint undefined = index.html
    chunk    {0} index.html 542 kB [entry] [rendered]
        > [../node_modules/html-webpack-plugin/lib/loader.js!./index.ejs]
webpack: bundle is now VALID.

No linter messages :(

To better understand what output I want to get, try also to change/save (for example add console.log statement, or make syntax error) any files in src folder. You should see messages both from server and linter on every file save. With redrun unfortunately my linter stays silent.

from redrun.

coderaiser avatar coderaiser commented on June 19, 2024

Have you tried to use redrun without flag -p? Is result the same?

from redrun.

stsiarzhanau avatar stsiarzhanau commented on June 19, 2024

The same.

If I run tasks sequentially...

redrun serve:src lint:watch
run-s serve:src lint:watch
npm run serve:src && npm run lint:watch

I have the same output in all 3 cases.
Runs only 1st task.
I suppose it is expected behaviour as 2nd should wait 1st to exit
(correct me if I'm not right).

Output:

redrun serve:src lint:watch

C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter (master) ([email protected])
λ npm start

> [email protected] prestart C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> babel-node tools/startMessage.js


=>  Starting development server to serve files from src folder...
=>  mocha and ESLint will run in watch mode...
=>  Hot Module Replacement, React Hot Loader 3, Browsersync...

:)  Enjoy!


> [email protected] start C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> redrun serve:src lint:watch

> cross-env NODE_ENV=development babel-node tools/srcServer.js && esw src tools webpackConfig --color --watch

[BS]  Browsersync server is running.
[BS]  NODE_ENV is set to development.
[BS]  Access URLs are listed below.

[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.100.2:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.100.2:3001
 --------------------------------------
[BS] Serving files from: src
[BS] Watching files...
webpack built d2bc411306b7859e47de in 2359ms
Version: webpack 2.2.0-rc.4
     Asset     Size  Chunks                    Chunk Names
 bundle.js  2.79 MB       0  [emitted]  [big]  main
index.html  1.21 kB          [emitted]
Entrypoint main [big] = bundle.js
chunk    {0} bundle.js (main) 960 kB [entry] [rendered]
    > main [0]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0
    Entrypoint undefined = index.html
    chunk    {0} index.html 542 kB [entry] [rendered]
        > [../node_modules/html-webpack-plugin/lib/loader.js!./index.ejs]
webpack: bundle is now VALID.

run-s serve:src lint:watch

C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter (master) ([email protected])
λ npm start

> [email protected] prestart C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> babel-node tools/startMessage.js


=>  Starting development server to serve files from src folder...
=>  mocha and ESLint will run in watch mode...
=>  Hot Module Replacement, React Hot Loader 3, Browsersync...

:)  Enjoy!


> [email protected] start C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> run-s serve:src lint:watch


> [email protected] serve:src C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> cross-env NODE_ENV=development babel-node tools/srcServer.js


[BS]  Browsersync server is running.
[BS]  NODE_ENV is set to development.
[BS]  Access URLs are listed below.

[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.100.2:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.100.2:3001
 --------------------------------------
[BS] Serving files from: src
[BS] Watching files...
webpack built d2bc411306b7859e47de in 2405ms
Version: webpack 2.2.0-rc.4
     Asset     Size  Chunks                    Chunk Names
 bundle.js  2.79 MB       0  [emitted]  [big]  main
index.html  1.21 kB          [emitted]
Entrypoint main [big] = bundle.js
chunk    {0} bundle.js (main) 960 kB [entry] [rendered]
    > main [0]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0
    Entrypoint undefined = index.html
    chunk    {0} index.html 542 kB [entry] [rendered]
        > [../node_modules/html-webpack-plugin/lib/loader.js!./index.ejs]
webpack: bundle is now VALID.

npm run serve:src && npm run lint:watch:

C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter (master) ([email protected])
λ npm start

> [email protected] prestart C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> babel-node tools/startMessage.js


=>  Starting development server to serve files from src folder...
=>  mocha and ESLint will run in watch mode...
=>  Hot Module Replacement, React Hot Loader 3, Browsersync...

:)  Enjoy!


> [email protected] start C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter
> redrun serve:src lint:watch

> cross-env NODE_ENV=development babel-node tools/srcServer.js && esw src tools webpackConfig --color --watch

[BS]  Browsersync server is running.
[BS]  NODE_ENV is set to development.
[BS]  Access URLs are listed below.

[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.100.2:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.100.2:3001
 --------------------------------------
[BS] Serving files from: src
[BS] Watching files...
webpack built d2bc411306b7859e47de in 3333ms
Version: webpack 2.2.0-rc.4
     Asset     Size  Chunks                    Chunk Names
 bundle.js  2.79 MB       0  [emitted]  [big]  main
index.html  1.21 kB          [emitted]
Entrypoint main [big] = bundle.js
chunk    {0} bundle.js (main) 960 kB [entry] [rendered]
    > main [0]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0
    Entrypoint undefined = index.html
    chunk    {0} index.html 542 kB [entry] [rendered]
        > [../node_modules/html-webpack-plugin/lib/loader.js!./index.ejs]
webpack: bundle is now VALID.

from redrun.

coderaiser avatar coderaiser commented on June 19, 2024

As I understand, the thing is: both your dev-server and linter uses stdin and stdout.
npm-run-all executes independently 2 child processes. And redrun makes only one call to child_process and system shell allocate one stdin and stdout for this purpose.

It is not a problem for Unix but looks like sometimes Windows could not do this. You can try to use eslint with nodemon. I never had problems with it.

Another solution is to activate ubuntu on windows.

Maybe npm-run-all better feets you neads. Anyways redrun is great when you need build, lint your code, do some tasks, so it is not for Unix only.

But it can do nothing more then system shell does, so if Windows could not run this construction:

.\node_modules\.bin\cross-env NODE_ENV=development .\node_modules\.bin\babel-node tools\srcServer.js & .\node_modules\.bin\esw src tools webpackConfig --color --watch

redrun can't either.

from redrun.

stsiarzhanau avatar stsiarzhanau commented on June 19, 2024

The story gets better!

I tried it in cmder.
.\node_modules\.bin\cross-env NODE_ENV=development .\node_modules\.bin\babel-node tools\srcServer.js & .\node_modules\.bin\esw src tools webpackConfig --color --watch
Result the same as before (only server output).

BUT!!!

When I tried the same command in GitBash (just swap manually all \ to / cause it can't handle former)...
I eventually get the expected result (server + linter output).
But only initially.
When I hit Ctrl+C it seems like it doesn't kill server process and when later I rerun start script and save any file I get messy server output.
Any ideas?

Initial output

$ ./node_modules/.bin/cross-env NODE_ENV=development ./node_modules/.bin/babel-node tools/srcServer.js & ./node_modules/.bin/esw src tools webpackConfig --color --watch
[3] 8260
C:\OpenServer\domains\EXAMPLES\webpack-react-redux-starter\src\components\Layout.js (2/0)
  ✖  5:1  Unexpected var, use let or const instead  no-var
  ✖  5:5  'a' is defined but never used             no-unused-vars

✖ 2 errors (23:32:38)

[BS]  Browsersync server is running.
[BS]  NODE_ENV is set to development.
[BS]  Access URLs are listed below.

[BS] Access URLs:
 --------------------------------------
       Local: http://localhost:3006
    External: http://192.168.100.2:3006
 --------------------------------------
          UI: http://localhost:3007
 UI External: http://192.168.100.2:3007
 --------------------------------------
[BS] Serving files from: src
[BS] Watching files...
webpack built 4066f97aaccd536074a4 in 2630ms
Version: webpack 2.2.0-rc.4
     Asset     Size  Chunks                    Chunk Names
 bundle.js  2.79 MB       0  [emitted]  [big]  main
index.html  1.21 kB          [emitted]
Entrypoint main [big] = bundle.js
chunk    {0} bundle.js (main) 960 kB [entry] [rendered]
    > main [0]
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  1.48 MB       0
    Entrypoint undefined = index.html
    chunk    {0} index.html 542 kB [entry] [rendered]
        > [../node_modules/html-webpack-plugin/lib/loader.js!./index.ejs]
webpack: bundle is now VALID.

from redrun.

coderaiser avatar coderaiser commented on June 19, 2024

When I hit Ctrl+C it seems like it doesn't kill server process and when later I rerun start script and save any file I get messy server output.
Any ideas?

The thing is server process runs on a background. OS does not close all processes with Ctrl + C, so:

ping & ping
^C

Will stop only second ping, first one will run in a background. But when you start scripts with redrun, using package.json's scripts:

{
    "scripts": {
        "ping1": "ping google.com",
        "ping2": "ping google.com",
        "ping": "redrun -p ping1 ping2"
    }
}

Next command will run both ping's and then stop both of them with <Ctrl> + C.

redrun ping
^C

Try to use start script with redrun in GitBash.

from redrun.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.